var Encoder = {
    // private property
    _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

    // public method for encoding
    Encode64: function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;

        input = Encoder._utf8_encode(input);

        while (i < input.length) {

            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);

            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;

            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }

            output = output +
                this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
                    this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

        }

        return output;
    },

    Decode64: function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }

        }

        output = Encoder._utf8_decode(output);

        return output;

    },

    // private method for UTF-8 encoding
    _utf8_encode: function (string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            } else if ((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            } else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode: function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while (i < utftext.length) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            } else if ((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i + 1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            } else {
                c2 = utftext.charCodeAt(i + 1);
                c3 = utftext.charCodeAt(i + 2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    },

//    xLzwEncode: function (s) {
//        var dict = {};
//        var data = (s + "").split("");
//        var out = [];
//        var currChar;
//        var phrase = data[0];
//        var cxd = 256;
//        for (var i = 1; i < data.length; i++) {
//            currChar = data[i];
//            if (dict[phrase + currChar] != null) {
//                phrase += currChar;
//            } else {
//                out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
//                dict[phrase + currChar] = cxd;
//                cxd++;
//                phrase = currChar;
//            }
//        }
//        out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
//        for (var j = 0; j < out.length; j++) {
//            out[j] = String.fromCharCode(out[j]);
//        }
//        return out.join("");
//    },

    LzwDecode: function (s) {
        var dict = {};
        var data = (s + "").split("");
        var currChar = data[0];
        var oldPhrase = currChar;
        var out = [currChar];
        var cxd = 256;
        var phrase;
        for (var i = 1; i < data.length; i++) {
            var currCode = data[i].charCodeAt(0);
            if (currCode < 256) {
                phrase = data[i];
            } else {
                phrase = dict[currCode] ? dict[currCode] : (oldPhrase + currChar);
            }
            out.push(phrase);
            currChar = phrase.charAt(0);
            dict[cxd] = oldPhrase + currChar;
            cxd++;
            oldPhrase = phrase;
        }
        return out.join("");
    },

    LzwEncode: function (uncompressed) {
        //"use strict";
        // Build the dictionary.
        var i,
            dictionary = {},
            c,
            wc,
            w = "",
            result = [],
            dictSize = 256;
        for (i = 0; i < 256; i += 1) {
            dictionary[String.fromCharCode(i)] = i;
        }

        for (i = 0; i < uncompressed.length; i += 1) {
            c = uncompressed.charAt(i);
            wc = w + c;
            if (dictionary[wc]) {
                w = wc;
            } else {
                result.push(dictionary[w]);
                // Add wc to the dictionary.
                dictionary[wc] = dictSize++;
                w = String(c);
            }
        }

        // Output the code for w.
        if (w !== "") {
            result.push(dictionary[w]);
        }
        for (var j = 0; j < result.length; j++) {
            result[j] = String.fromCharCode(result[j]);
        }
        return result.join("");
    }

//    xLzwDecode: function (compressed) {
//        "use strict";
//        // Build the dictionary.
//        var i,
//            dictionary = [],
//            w,
//            result,
//            k,
//            entry = "",
//            dictSize = 256;
//        for (i = 0; i < 256; i += 1) {
//            dictionary[i] = String.fromCharCode(i);
//        }

//        w = String.fromCharCode(compressed[0]);
//        result = w;
//        for (i = 1; i < compressed.length; i += 1) {
//            k = compressed[i];
//            if (dictionary[k]) {
//                entry = dictionary[k];
//            } else {
//                if (k === dictSize) {
//                    entry = w + w.charAt(0);
//                } else {
//                    return null;
//                }
//            }

//            result += entry;

//            // Add w+entry[0] to the dictionary.
//            dictionary[dictSize++] = w + entry.charAt(0);

//            w = entry;
//        }
//        return result;
//    } 
};


if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;}Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;}return'\\u'+('0000'+(+(a.charCodeAt(0))).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}return{stringify:function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});},parse:function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+(+(a.charCodeAt(0))).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');}};}();}

//! Script# Core Runtime
//! More information at http://projects.nikhilk.net/ScriptSharp
//!

///////////////////////////////////////////////////////////////////////////////
// Globals

(function () {
  var globals = {
    version: '0.7.4.0',

    isUndefined: function (o) {
      return (o === undefined);
    },

    isNull: function (o) {
      return (o === null);
    },

    isNullOrUndefined: function (o) {
      return (o === null) || (o === undefined);
    },

    isValue: function (o) {
      return (o !== null) && (o !== undefined);
    }
  };

  var started = false;
  var startCallbacks = [];

  function onStartup(cb) {
    startCallbacks ? startCallbacks.push(cb) : setTimeout(cb, 0);
  }
  function startup() {
    if (startCallbacks) {
      var callbacks = startCallbacks;
      startCallbacks = null;
      for (var i = 0, l = callbacks.length; i < l; i++) {
        callbacks[i]();
      }
    }
  }
  if (document.addEventListener) {
    document.readyState == 'complete' ? startup() : document.addEventListener('DOMContentLoaded', startup, false);
  }
  else if (window.attachEvent) {
    window.attachEvent('onload', function () {
      startup();
    });
  }

  var ss = window.ss;
  if (!ss) {
    window.ss = ss = {
      init: onStartup,
      ready: onStartup
    };
  }
  for (var n in globals) {
    ss[n] = globals[n];
  }
})();

///////////////////////////////////////////////////////////////////////////////
// Object Extensions

Object.__typeName = 'Object';
Object.__baseType = null;

Object.clearKeys = function Object$clearKeys(d) {
    for (var n in d) {
        delete d[n];
    }
}

Object.keyExists = function Object$keyExists(d, key) {
    return d[key] !== undefined;
}

if (!Object.keys) {
    Object.keys = function Object$keys(d) {
        var keys = [];
        for (var n in d) {
            keys.push(n);
        }
        return keys;
    }

    Object.getKeyCount = function Object$getKeyCount(d) {
        var count = 0;
        for (var n in d) {
            count++;
        }
        return count;
    }
}
else {
    Object.getKeyCount = function Object$getKeyCount(d) {
        return Object.keys(d).length;
    }
}

///////////////////////////////////////////////////////////////////////////////
// Boolean Extensions

Boolean.__typeName = 'Boolean';

Boolean.parse = function Boolean$parse(s) {
    return (s.toLowerCase() == 'true');
}

///////////////////////////////////////////////////////////////////////////////
// Number Extensions

Number.__typeName = 'Number';

Number.parse = function Number$parse(s) {
    if (!s || !s.length) {
        return 0;
    }
    if ((s.indexOf('.') >= 0) || (s.indexOf('e') >= 0) ||
        s.endsWith('f') || s.endsWith('F')) {
        return parseFloat(s);
    }
    return parseInt(s, 10);
}

Number.prototype.format = function Number$format(format) {
    if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) {
        return this.toString();
    }
    return this._netFormat(format, false);
}

Number.prototype.localeFormat = function Number$format(format) {
    if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) {
        return this.toLocaleString();
    }
    return this._netFormat(format, true);
}

Number._commaFormat = function Number$_commaFormat(number, groups, decimal, comma) {
    var decimalPart = null;
    var decimalIndex = number.indexOf(decimal);
    if (decimalIndex > 0) {
        decimalPart = number.substr(decimalIndex);
        number = number.substr(0, decimalIndex);
    }

    var negative = number.startsWith('-');
    if (negative) {
        number = number.substr(1);
    }

    var groupIndex = 0;
    var groupSize = groups[groupIndex];
    if (number.length < groupSize) {
        return decimalPart ? number + decimalPart : number;
    }

    var index = number.length;
    var s = '';
    var done = false;
    while (!done) {
        var length = groupSize;
        var startIndex = index - length;
        if (startIndex < 0) {
            groupSize += startIndex;
            length += startIndex;
            startIndex = 0;
            done = true;
        }
        if (!length) {
            break;
        }
        
        var part = number.substr(startIndex, length);
        if (s.length) {
            s = part + comma + s;
        }
        else {
            s = part;
        }
        index -= length;

        if (groupIndex < groups.length - 1) {
            groupIndex++;
            groupSize = groups[groupIndex];
        }
    }

    if (negative) {
        s = '-' + s;
    }    
    return decimalPart ? s + decimalPart : s;
}

Number.prototype._netFormat = function Number$_netFormat(format, useLocale) {
    var nf = useLocale ? ss.CultureInfo.CurrentCulture.numberFormat : ss.CultureInfo.InvariantCulture.numberFormat;

    var s = '';    
    var precision = -1;
    
    if (format.length > 1) {
        precision = parseInt(format.substr(1));
    }

    var fs = format.charAt(0);
    switch (fs) {
        case 'd': case 'D':
            s = parseInt(Math.abs(this)).toString();
            if (precision != -1) {
                s = s.padLeft(precision, '0');
            }
            if (this < 0) {
                s = '-' + s;
            }
            break;
        case 'x': case 'X':
            s = parseInt(Math.abs(this)).toString(16);
            if (fs == 'X') {
                s = s.toUpperCase();
            }
            if (precision != -1) {
                s = s.padLeft(precision, '0');
            }
            break;
        case 'e': case 'E':
            if (precision == -1) {
                s = this.toExponential();
            }
            else {
                s = this.toExponential(precision);
            }
            if (fs == 'E') {
                s = s.toUpperCase();
            }
            break;
        case 'f': case 'F':
        case 'n': case 'N':
            if (precision == -1) {
                precision = nf.numberDecimalDigits;
            }
            s = this.toFixed(precision).toString();
            if (precision && (nf.numberDecimalSeparator != '.')) {
                var index = s.indexOf('.');
                s = s.substr(0, index) + nf.numberDecimalSeparator + s.substr(index + 1);
            }
            if ((fs == 'n') || (fs == 'N')) {
                s = Number._commaFormat(s, nf.numberGroupSizes, nf.numberDecimalSeparator, nf.numberGroupSeparator);
            }
            break;
        case 'c': case 'C':
            if (precision == -1) {
                precision = nf.currencyDecimalDigits;
            }
            s = Math.abs(this).toFixed(precision).toString();
            if (precision && (nf.currencyDecimalSeparator != '.')) {
                var index = s.indexOf('.');
                s = s.substr(0, index) + nf.currencyDecimalSeparator + s.substr(index + 1);
            }
            s = Number._commaFormat(s, nf.currencyGroupSizes, nf.currencyDecimalSeparator, nf.currencyGroupSeparator);
            if (this < 0) {
                s = String.format(nf.currencyNegativePattern, s);
            }
            else {
                s = String.format(nf.currencyPositivePattern, s);
            }
            break;
        case 'p': case 'P':
            if (precision == -1) {
                precision = nf.percentDecimalDigits;
            }
            s = (Math.abs(this) * 100.0).toFixed(precision).toString();
            if (precision && (nf.percentDecimalSeparator != '.')) {
                var index = s.indexOf('.');
                s = s.substr(0, index) + nf.percentDecimalSeparator + s.substr(index + 1);
            }
            s = Number._commaFormat(s, nf.percentGroupSizes, nf.percentDecimalSeparator, nf.percentGroupSeparator);
            if (this < 0) {
                s = String.format(nf.percentNegativePattern, s);
            }
            else {
                s = String.format(nf.percentPositivePattern, s);
            }
            break;
    }

    return s;
}

///////////////////////////////////////////////////////////////////////////////
// String Extensions

String.__typeName = 'String';
String.Empty = '';

String.compare = function String$compare(s1, s2, ignoreCase) {
    if (ignoreCase) {
        if (s1) {
            s1 = s1.toUpperCase();
        }
        if (s2) {
            s2 = s2.toUpperCase();
        }
    }
    s1 = s1 || '';
    s2 = s2 || '';

    if (s1 == s2) {
        return 0;
    }
    if (s1 < s2) {
        return -1;
    }
    return 1;
}

String.prototype.compareTo = function String$compareTo(s, ignoreCase) {
    return String.compare(this, s, ignoreCase);
}

String.concat = function String$concat() {
    if (arguments.length === 2) {
        return arguments[0] + arguments[1];
    }
    return Array.prototype.join.call(arguments, '');
}

String.prototype.endsWith = function String$endsWith(suffix) {
    if (!suffix.length) {
        return true;
    }
    if (suffix.length > this.length) {
        return false;
    }
    return (this.substr(this.length - suffix.length) == suffix);
}

String.equals = function String$equals1(s1, s2, ignoreCase) {
    return String.compare(s1, s2, ignoreCase) == 0;
}

String._format = function String$_format(format, values, useLocale) {
    if (!String._formatRE) {
        String._formatRE = /(\{[^\}^\{]+\})/g;
    }

    return format.replace(String._formatRE,
                          function(str, m) {
                              var index = parseInt(m.substr(1));
                              var value = values[index + 1];
                              if (ss.isNullOrUndefined(value)) {
                                  return '';
                              }
                              if (value.format) {
                                  var formatSpec = null;
                                  var formatIndex = m.indexOf(':');
                                  if (formatIndex > 0) {
                                      formatSpec = m.substring(formatIndex + 1, m.length - 1);
                                  }
                                  return useLocale ? value.localeFormat(formatSpec) : value.format(formatSpec);
                              }
                              else {
                                  return useLocale ? value.toLocaleString() : value.toString();
                              }
                          });
}

String.format = function String$format(format) {
    return String._format(format, arguments, /* useLocale */ false);
}

String.fromChar = function String$fromChar(ch, count) {
    var s = ch;
    for (var i = 1; i < count; i++) {
        s += ch;
    }
    return s;
}

String.prototype.htmlDecode = function String$htmlDecode() {
    var div = document.createElement('div');
    div.innerHTML = this;
    return div.textContent || div.innerText;
}

String.prototype.htmlEncode = function String$htmlEncode() {
    var div = document.createElement('div');
    div.appendChild(document.createTextNode(this));
    return div.innerHTML.replace(/\"/g, '&quot;');
}

String.prototype.indexOfAny = function String$indexOfAny(chars, startIndex, count) {
    var length = this.length;
    if (!length) {
        return -1;
    }

    startIndex = startIndex || 0;
    count = count || length;

    var endIndex = startIndex + count - 1;
    if (endIndex >= length) {
        endIndex = length - 1;
    }

    for (var i = startIndex; i <= endIndex; i++) {
        if (chars.indexOf(this.charAt(i)) >= 0) {
            return i;
        }
    }
    return -1;
}

String.prototype.insert = function String$insert(index, value) {
    if (!value) {
        return this;
    }
    if (!index) {
        return value + this;
    }
    var s1 = this.substr(0, index);
    var s2 = this.substr(index);
    return s1 + value + s2;
}

String.isNullOrEmpty = function String$isNullOrEmpty(s) {
    return !s || !s.length;
}

String.prototype.lastIndexOfAny = function String$lastIndexOfAny(chars, startIndex, count) {
    var length = this.length;
    if (!length) {
        return -1;
    }

    startIndex = startIndex || length - 1;
    count = count || length;

    var endIndex = startIndex - count + 1;
    if (endIndex < 0) {
        endIndex = 0;
    }

    for (var i = startIndex; i >= endIndex; i--) {
        if (chars.indexOf(this.charAt(i)) >= 0) {
            return i;
        }
    }
    return -1;
}

String.localeFormat = function String$localeFormat(format) {
    return String._format(format, arguments, /* useLocale */ true);
}

String.prototype.padLeft = function String$padLeft(totalWidth, ch) {
    if (this.length < totalWidth) {
        ch = ch || ' ';
        return String.fromChar(ch, totalWidth - this.length) + this;
    }
    return this;
}

String.prototype.padRight = function String$padRight(totalWidth, ch) {
    if (this.length < totalWidth) {
        ch = ch || ' ';
        return this + String.fromChar(ch, totalWidth - this.length);
    }
    return this;
}

String.prototype.remove = function String$remove(index, count) {
    if (!count || ((index + count) > this.length)) {
        return this.substr(0, index);
    }
    return this.substr(0, index) + this.substr(index + count);
}

String.prototype.replaceAll = function String$replaceAll(oldValue, newValue) {
    newValue = newValue || '';
    return this.split(oldValue).join(newValue);
}

String.prototype.startsWith = function String$startsWith(prefix) {
    if (!prefix.length) {
        return true;
    }
    if (prefix.length > this.length) {
        return false;
    }
    return (this.substr(0, prefix.length) == prefix);
}

if (!String.prototype.trim) {
    String.prototype.trim = function String$trim() {
        return this.trimEnd().trimStart();
    }
}

String.prototype.trimEnd = function String$trimEnd() {
    return this.replace(/\s*$/, '');
}

String.prototype.trimStart = function String$trimStart() {
    return this.replace(/^\s*/, '');
}

///////////////////////////////////////////////////////////////////////////////
// Array Extensions

Array.__typeName = 'Array';
Array.__interfaces = [ ss.IEnumerable ];

Array.prototype.add = function Array$add(item) {
    this[this.length] = item;
}

Array.prototype.addRange = function Array$addRange(items) {
    this.push.apply(this, items);
}

Array.prototype.aggregate = function Array$aggregate(seed, callback, instance) {
    var length = this.length;
    for (var i = 0; i < length; i++) {
        if (i in this) {
            seed = callback.call(instance, seed, this[i], i, this);
        }
    }
    return seed;
}

Array.prototype.clear = function Array$clear() {
    this.length = 0;
}

Array.prototype.clone = function Array$clone() {
    if (this.length === 1) {
        return [this[0]];
    }
    else {
        return Array.apply(null, this);
    }
}

Array.prototype.contains = function Array$contains(item) {
    var index = this.indexOf(item);
    return (index >= 0);
}

Array.prototype.dequeue = function Array$dequeue() {
    return this.shift();
}

Array.prototype.enqueue = function Array$enqueue(item) {
    // We record that this array instance is a queue, so we
    // can implement the right behavior in the peek method.
    this._queue = true;
    this.push(item);
}

Array.prototype.peek = function Array$peek() {
    if (this.length) {
        var index = this._queue ? 0 : this.length - 1;
        return this[index];
    }
    return null;
}

if (!Array.prototype.every) {
    Array.prototype.every = function Array$every(callback, instance) {
        var length = this.length;
        for (var i = 0; i < length; i++) {
            if (i in this && !callback.call(instance, this[i], i, this)) {
                return false;
            }
        }
        return true;
    }
}

Array.prototype.extract = function Array$extract(index, count) {
    if (!count) {
        return this.slice(index);
    }
    return this.slice(index, index + count);
}

if (!Array.prototype.filter) {
    Array.prototype.filter = function Array$filter(callback, instance) {
        var length = this.length;    
        var filtered = [];
        for (var i = 0; i < length; i++) {
            if (i in this) {
                var val = this[i];
                if (callback.call(instance, val, i, this)) {
                    filtered.push(val);
                }
            }
        }
        return filtered;
    }
}

if (!Array.prototype.forEach) {
    Array.prototype.forEach = function Array$forEach(callback, instance) {
        var length = this.length;
        for (var i = 0; i < length; i++) {
            if (i in this) {
                callback.call(instance, this[i], i, this);
            }
        }
    }
}

Array.prototype.getEnumerator = function Array$getEnumerator() {
    return new ss.ArrayEnumerator(this);
}

Array.prototype.groupBy = function Array$groupBy(callback, instance) {
    var length = this.length;
    var groups = [];
    var keys = {};
    for (var i = 0; i < length; i++) {
        if (i in this) {
            var key = callback.call(instance, this[i], i);
            if (String.isNullOrEmpty(key)) {
                continue;
            }
            var items = keys[key];
            if (!items) {
                items = [];
                items.key = key;

                keys[key] = items;
                groups.add(items);
            }
            items.add(this[i]);
        }
    }
    return groups;
}

Array.prototype.index = function Array$index(callback, instance) {
    var length = this.length;
    var items = {};
    for (var i = 0; i < length; i++) {
        if (i in this) {
            var key = callback.call(instance, this[i], i);
            if (String.isNullOrEmpty(key)) {
                continue;
            }
            items[key] = this[i];
        }
    }
    return items;
}

if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function Array$indexOf(item, startIndex) {
        startIndex = startIndex || 0;
        var length = this.length;
        if (length) {
            for (var index = startIndex; index < length; index++) {
                if (this[index] === item) {
                    return index;
                }
            }
        }
        return -1;
    }
}

Array.prototype.insert = function Array$insert(index, item) {
    this.splice(index, 0, item);
}

Array.prototype.insertRange = function Array$insertRange(index, items) {
    if (index === 0) {
        this.unshift.apply(this, items);
    }
    else {
        for (var i = 0; i < items.length; i++) {
            this.splice(index + i, 0, items[i]);
        }
    }
}

if (!Array.prototype.map) {
    Array.prototype.map = function Array$map(callback, instance) {
        var length = this.length;
        var mapped = new Array(length);
        for (var i = 0; i < length; i++) {
            if (i in this) {
                mapped[i] = callback.call(instance, this[i], i, this);
            }
        }
        return mapped;
    }
}

Array.parse = function Array$parse(s) {
    return eval('(' + s + ')');
}

Array.prototype.remove = function Array$remove(item) {
    var index = this.indexOf(item);
    if (index >= 0) {
        this.splice(index, 1);
        return true;
    }
    return false;
}

Array.prototype.removeAt = function Array$removeAt(index) {
    this.splice(index, 1);
}

Array.prototype.removeRange = function Array$removeRange(index, count) {
    return this.splice(index, count);
}

if (!Array.prototype.some) {
    Array.prototype.some = function Array$some(callback, instance) {
        var length = this.length;
        for (var i = 0; i < length; i++) {
            if (i in this && callback.call(instance, this[i], i, this)) {
                return true;
            }
        }
        return false;
    }
}

Array.toArray = function Array$toArray(obj) {
    return Array.prototype.slice.call(obj);
}

///////////////////////////////////////////////////////////////////////////////
// RegExp Extensions

RegExp.__typeName = 'RegExp';

RegExp.parse = function RegExp$parse(s) {
    if (s.startsWith('/')) {
        var endSlashIndex = s.lastIndexOf('/');
        if (endSlashIndex > 1) {
            var expression = s.substring(1, endSlashIndex);
            var flags = s.substr(endSlashIndex + 1);
            return new RegExp(expression, flags);
        }
    }

    return null;    
}

///////////////////////////////////////////////////////////////////////////////
// Date Extensions

Date.__typeName = 'Date';

Date.empty = null;

Date.get_now = function Date$get_now() {
    return new Date();
}

Date.get_today = function Date$get_today() {
    var d = new Date();
    return new Date(d.getFullYear(), d.getMonth(), d.getDate());
}

Date.isEmpty = function Date$isEmpty(d) {
    return (d === null) || (d.valueOf() === 0);
}

Date.prototype.format = function Date$format(format) {
    if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) {
        return this.toString();
    }
    if (format == 'id') {
        return this.toDateString();
    }
    if (format == 'it') {
        return this.toTimeString();
    }

    return this._netFormat(format, false);
}

Date.prototype.localeFormat = function Date$localeFormat(format) {
    if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) {
        return this.toLocaleString();
    }
    if (format == 'id') {
        return this.toLocaleDateString();
    }
    if (format == 'it') {
        return this.toLocaleTimeString();
    }

    return this._netFormat(format, true);
}

Date.prototype._netFormat = function Date$_netFormat(format, useLocale) {
    var dt = this;
    var dtf = useLocale ? ss.CultureInfo.CurrentCulture.dateFormat : ss.CultureInfo.InvariantCulture.dateFormat;

    if (format.length == 1) {
        switch (format) {
            case 'f': format = dtf.longDatePattern + ' ' + dtf.shortTimePattern; break;
            case 'F': format = dtf.dateTimePattern; break;

            case 'd': format = dtf.shortDatePattern; break;
            case 'D': format = dtf.longDatePattern; break;

            case 't': format = dtf.shortTimePattern; break;
            case 'T': format = dtf.longTimePattern; break;

            case 'g': format = dtf.shortDatePattern + ' ' + dtf.shortTimePattern; break;
            case 'G': format = dtf.shortDatePattern + ' ' + dtf.longTimePattern; break;

            case 'R': case 'r':
                dtf = ss.CultureInfo.InvariantCulture.dateFormat;
                format = dtf.gmtDateTimePattern;
                break;
            case 'u': format = dtf.universalDateTimePattern; break;
            case 'U':
                format = dtf.dateTimePattern;
                dt = new Date(dt.getUTCFullYear(), dt.getUTCMonth(), dt.getUTCDate(),
                              dt.getUTCHours(), dt.getUTCMinutes(), dt.getUTCSeconds(), dt.getUTCMilliseconds());
                break;

            case 's': format = dtf.sortableDateTimePattern; break;
        }
    }

    if (format.charAt(0) == '%') {
        format = format.substr(1);
    }

    if (!Date._formatRE) {
        Date._formatRE = /'.*?[^\\]'|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g;
    }

    var re = Date._formatRE;
    var sb = new ss.StringBuilder();

    re.lastIndex = 0;
    while (true) {
        var index = re.lastIndex;
        var match = re.exec(format);

        sb.append(format.slice(index, match ? match.index : format.length));
        if (!match) {
            break;
        }

        var fs = match[0];
        var part = fs;
        switch (fs) {
            case 'dddd':
                part = dtf.dayNames[dt.getDay()];
                break;
            case 'ddd':
                part = dtf.shortDayNames[dt.getDay()];
                break;
            case 'dd':
                part = dt.getDate().toString().padLeft(2, '0');
                break;
            case 'd':
                part = dt.getDate();
                break;
            case 'MMMM':
                part = dtf.monthNames[dt.getMonth()];
                break;
            case 'MMM':
                part = dtf.shortMonthNames[dt.getMonth()];
                break;
            case 'MM':
                part = (dt.getMonth() + 1).toString().padLeft(2, '0');
                break;
            case 'M':
                part = (dt.getMonth() + 1);
                break;
            case 'yyyy':
                part = dt.getFullYear();
                break;
            case 'yy':
                part = (dt.getFullYear() % 100).toString().padLeft(2, '0');
                break;
            case 'y':
                part = (dt.getFullYear() % 100);
                break;
            case 'h': case 'hh':
                part = dt.getHours() % 12;
                if (!part) {
                    part = '12';
                }
                else if (fs == 'hh') {
                    part = part.toString().padLeft(2, '0');
                }
                break;
            case 'HH':
                part = dt.getHours().toString().padLeft(2, '0');
                break;
            case 'H':
                part = dt.getHours();
                break;
            case 'mm':
                part = dt.getMinutes().toString().padLeft(2, '0');
                break;
            case 'm':
                part = dt.getMinutes();
                break;
            case 'ss':
                part = dt.getSeconds().toString().padLeft(2, '0');
                break;
            case 's':
                part = dt.getSeconds();
                break;
            case 't': case 'tt':
                part = (dt.getHours() < 12) ? dtf.amDesignator : dtf.pmDesignator;
                if (fs == 't') {
                    part = part.charAt(0);
                }
                break;
            case 'fff':
                part = dt.getMilliseconds().toString().padLeft(3, '0');
                break;
            case 'ff':
                part = dt.getMilliseconds().toString().padLeft(3).substr(0, 2);
                break;
            case 'f':
                part = dt.getMilliseconds().toString().padLeft(3).charAt(0);
                break;
            case 'z':
                part = dt.getTimezoneOffset() / 60;
                part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part));
                break;
            case 'zz': case 'zzz':
                part = dt.getTimezoneOffset() / 60;
                part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)).toString().padLeft(2, '0');
                if (fs == 'zzz') {
                    part += dtf.timeSeparator + Math.abs(dt.getTimezoneOffset() % 60).toString().padLeft(2, '0');
                }
                break;
            default:
                if (part.charAt(0) == '\'') {
                    part = part.substr(1, part.length - 2).replace(/\\'/g, '\'');
                }
                break;
        }
        sb.append(part);
    }

    return sb.toString();
}

Date.parseDate = function Date$parse(s) {
    // Date.parse returns the number of milliseconds
    // so we use that to create an actual Date instance
    return new Date(Date.parse(s));
}

///////////////////////////////////////////////////////////////////////////////
// Error Extensions

Error.__typeName = 'Error';

Error.prototype.popStackFrame = function Error$popStackFrame() {
    if (ss.isNullOrUndefined(this.stack) ||
        ss.isNullOrUndefined(this.fileName) ||
        ss.isNullOrUndefined(this.lineNumber)) {
        return;
    }

    var stackFrames = this.stack.split('\n');
    var currentFrame = stackFrames[0];
    var pattern = this.fileName + ':' + this.lineNumber;
    while (!ss.isNullOrUndefined(currentFrame) &&
           currentFrame.indexOf(pattern) === -1) {
        stackFrames.shift();
        currentFrame = stackFrames[0];
    }

    var nextFrame = stackFrames[1];
    if (isNullOrUndefined(nextFrame)) {
        return;
    }

    var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
    if (ss.isNullOrUndefined(nextFrameParts)) {
        return;
    }

    stackFrames.shift();
    this.stack = stackFrames.join("\n");
    this.fileName = nextFrameParts[1];
    this.lineNumber = parseInt(nextFrameParts[2]);
}

Error.createError = function Error$createError(message, errorInfo, innerException) {
    var e = new Error(message);
    if (errorInfo) {
        for (var v in errorInfo) {
            e[v] = errorInfo[v];
        }
    }
    if (innerException) {
        e.innerException = innerException;
    }

    e.popStackFrame();
    return e;
}

///////////////////////////////////////////////////////////////////////////////
// Debug Extensions

ss.Debug = window.Debug || function() {};
ss.Debug.__typeName = 'Debug';

if (!ss.Debug.writeln) {
    ss.Debug.writeln = function Debug$writeln(text) {
        if (window.console) {
            if (window.console.debug) {
                window.console.debug(text);
                return;
            }
            else if (window.console.log) {
                window.console.log(text);
                return;
            }
        }
        else if (window.opera &&
            window.opera.postError) {
            window.opera.postError(text);
            return;
        }
    }
}

ss.Debug._fail = function Debug$_fail(message) {
    ss.Debug.writeln(message);
    eval('debugger;');
}

ss.Debug.assert = function Debug$assert(condition, message) {
    if (!condition) {
        message = 'Assert failed: ' + message;
        if (confirm(message + '\r\n\r\nBreak into debugger?')) {
            ss.Debug._fail(message);
        }
    }
}

ss.Debug.fail = function Debug$fail(message) {
    ss.Debug._fail(message);
}

///////////////////////////////////////////////////////////////////////////////
// Type System Implementation

window.Type = Function;
Type.__typeName = 'Type';

window.__Namespace = function(name) {
    this.__typeName = name;
}
__Namespace.prototype = {
    __namespace: true,
    getName: function() {
        return this.__typeName;
    }
}

Type.registerNamespace = function Type$registerNamespace(name) {
    if (!window.__namespaces) {
        window.__namespaces = {};
    }
    if (!window.__rootNamespaces) {
        window.__rootNamespaces = [];
    }

    if (window.__namespaces[name]) {
        return;
    }

    var ns = window;
    var nameParts = name.split('.');

    for (var i = 0; i < nameParts.length; i++) {
        var part = nameParts[i];
        var nso = ns[part];
        if (!nso) {
            ns[part] = nso = new __Namespace(nameParts.slice(0, i + 1).join('.'));
            if (i == 0) {
                window.__rootNamespaces.add(nso);
            }
        }
        ns = nso;
    }

    window.__namespaces[name] = ns;
}

Type.prototype.registerClass = function Type$registerClass(name, baseType, interfaceType) {
    this.prototype.constructor = this;
    this.__typeName = name;
    this.__class = true;
    this.__baseType = baseType || Object;
    if (baseType) {
        this.__basePrototypePending = true;
    }

    if (interfaceType) {
        this.__interfaces = [];
        for (var i = 2; i < arguments.length; i++) {
            interfaceType = arguments[i];
            this.__interfaces.add(interfaceType);
        }
    }
}

Type.prototype.registerInterface = function Type$createInterface(name) {
    this.__typeName = name;
    this.__interface = true;
}

Type.prototype.registerEnum = function Type$createEnum(name, flags) {
    for (var field in this.prototype) {
         this[field] = this.prototype[field];
    }

    this.__typeName = name;
    this.__enum = true;
    if (flags) {
        this.__flags = true;
    }
}

Type.prototype.setupBase = function Type$setupBase() {
    if (this.__basePrototypePending) {
        var baseType = this.__baseType;
        if (baseType.__basePrototypePending) {
            baseType.setupBase();
        }

        for (var memberName in baseType.prototype) {
            var memberValue = baseType.prototype[memberName];
            if (!this.prototype[memberName]) {
                this.prototype[memberName] = memberValue;
            }
        }

        delete this.__basePrototypePending;
    }
}

if (!Type.prototype.resolveInheritance) {
    // This function is not used by Script#; Visual Studio relies on it
    // for JavaScript IntelliSense support of derived types.
    Type.prototype.resolveInheritance = Type.prototype.setupBase;
}

Type.prototype.initializeBase = function Type$initializeBase(instance, args) {
    if (this.__basePrototypePending) {
        this.setupBase();
    }

    if (!args) {
        this.__baseType.apply(instance);
    }
    else {
        this.__baseType.apply(instance, args);
    }
}

Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, args) {
    var baseMethod = this.__baseType.prototype[name];
    if (!args) {
        return baseMethod.apply(instance);
    }
    else {
        return baseMethod.apply(instance, args);
    }
}

Type.prototype.get_baseType = function Type$get_baseType() {
    return this.__baseType || null;
}

Type.prototype.get_fullName = function Type$get_fullName() {
    return this.__typeName;
}

Type.prototype.get_name = function Type$get_name() {
    var fullName = this.__typeName;
    var nsIndex = fullName.lastIndexOf('.');
    if (nsIndex > 0) {
        return fullName.substr(nsIndex + 1);
    }
    return fullName;
}

Type.prototype.getInterfaces = function Type$getInterfaces() {
    return this.__interfaces;
}

Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
    if (ss.isNullOrUndefined(instance)) {
        return false;
    }
    if ((this == Object) || (instance instanceof this)) {
        return true;
    }

    var type = Type.getInstanceType(instance);
    return this.isAssignableFrom(type);
}

Type.prototype.isAssignableFrom = function Type$isAssignableFrom(type) {
    if ((this == Object) || (this == type)) {
        return true;
    }
    if (this.__class) {
        var baseType = type.__baseType;
        while (baseType) {
            if (this == baseType) {
                return true;
            }
            baseType = baseType.__baseType;
        }
    }
    else if (this.__interface) {
        var interfaces = type.__interfaces;
        if (interfaces && interfaces.contains(this)) {
            return true;
        }

        var baseType = type.__baseType;
        while (baseType) {
            interfaces = baseType.__interfaces;
            if (interfaces && interfaces.contains(this)) {
                return true;
            }
            baseType = baseType.__baseType;
        }
    }
    return false;
}

Type.isClass = function Type$isClass(type) {
    return (type.__class == true);
}

Type.isEnum = function Type$isEnum(type) {
    return (type.__enum == true);
}

Type.isFlags = function Type$isFlags(type) {
    return ((type.__enum == true) && (type.__flags == true));
}

Type.isInterface = function Type$isInterface(type) {
    return (type.__interface == true);
}

Type.isNamespace = function Type$isNamespace(object) {
    return (object.__namespace == true);
}

Type.canCast = function Type$canCast(instance, type) {
    return type.isInstanceOfType(instance);
}

Type.safeCast = function Type$safeCast(instance, type) {
    if (type.isInstanceOfType(instance)) {
        return instance;
    }
    return null;
}

Type.getInstanceType = function Type$getInstanceType(instance) {
    var ctor = null;

    // NOTE: We have to catch exceptions because the constructor
    //       cannot be looked up on native COM objects
    try {
        ctor = instance.constructor;
    }
    catch (ex) {
    }
    if (!ctor || !ctor.__typeName) {
        ctor = Object;
    }
    return ctor;
}

Type.getType = function Type$getType(typeName) {
    if (!typeName) {
        return null;
    }

    if (!Type.__typeCache) {
        Type.__typeCache = {};
    }

    var type = Type.__typeCache[typeName];
    if (!type) {
        type = eval(typeName);
        Type.__typeCache[typeName] = type;
    }
    return type;
}

Type.parse = function Type$parse(typeName) {
    return Type.getType(typeName);
}

///////////////////////////////////////////////////////////////////////////////
// Delegate

ss.Delegate = function Delegate$() {
}
ss.Delegate.registerClass('Delegate');

ss.Delegate.empty = function() { }

ss.Delegate._contains = function Delegate$_contains(targets, object, method) {
    for (var i = 0; i < targets.length; i += 2) {
        if (targets[i] === object && targets[i + 1] === method) {
            return true;
        }
    }
    return false;
}

ss.Delegate._create = function Delegate$_create(targets) {
    var delegate = function() {
        if (targets.length == 2) {
            return targets[1].apply(targets[0], arguments);
        }
        else {
            var clone = targets.clone();
            for (var i = 0; i < clone.length; i += 2) {
                if (ss.Delegate._contains(targets, clone[i], clone[i + 1])) {
                    clone[i + 1].apply(clone[i], arguments);
                }
            }
            return null;
        }
    };
    delegate._targets = targets;

    return delegate;
}

ss.Delegate.create = function Delegate$create(object, method) {
    if (!object) {
        return method;
    }
    return ss.Delegate._create([object, method]);
}

ss.Delegate.combine = function Delegate$combine(delegate1, delegate2) {
    if (!delegate1) {
        if (!delegate2._targets) {
            return ss.Delegate.create(null, delegate2);
        }
        return delegate2;
    }
    if (!delegate2) {
        if (!delegate1._targets) {
            return ss.Delegate.create(null, delegate1);
        }
        return delegate1;
    }

    var targets1 = delegate1._targets ? delegate1._targets : [null, delegate1];
    var targets2 = delegate2._targets ? delegate2._targets : [null, delegate2];

    return ss.Delegate._create(targets1.concat(targets2));
}

ss.Delegate.remove = function Delegate$remove(delegate1, delegate2) {
    if (!delegate1 || (delegate1 === delegate2)) {
        return null;
    }
    if (!delegate2) {
        return delegate1;
    }

    var targets = delegate1._targets;
    var object = null;
    var method;
    if (delegate2._targets) {
        object = delegate2._targets[0];
        method = delegate2._targets[1];
    }
    else {
        method = delegate2;
    }

    for (var i = 0; i < targets.length; i += 2) {
        if ((targets[i] === object) && (targets[i + 1] === method)) {
            if (targets.length == 2) {
                return null;
            }
            targets.splice(i, 2);
            return ss.Delegate._create(targets);
        }
    }

    return delegate1;
}

ss.Delegate.createExport = function Delegate$createExport(delegate, multiUse, name) {
    // Generate a unique name if one is not specified
    name = name || '__' + (new Date()).valueOf();

    // Exported delegates go on window (so they are callable using a simple identifier).

    // Multi-use delegates are exported directly; for the rest a stub is exported, and the stub
    // first deletes, and then invokes the actual delegate.
    window[name] = multiUse ? delegate : function() {
      try { delete window[name]; } catch(e) { window[name] = undefined; }
      delegate.apply(null, arguments);
    };

    return name;
}

ss.Delegate.deleteExport = function Delegate$deleteExport(name) {
    delete window[name];
}

ss.Delegate.clearExport = function Delegate$clearExport(name) {
    window[name] = ss.Delegate.empty;
}

///////////////////////////////////////////////////////////////////////////////
// CultureInfo

ss.CultureInfo = function CultureInfo$(name, numberFormat, dateFormat) {
    this.name = name;
    this.numberFormat = numberFormat;
    this.dateFormat = dateFormat;
}
ss.CultureInfo.registerClass('CultureInfo');

ss.CultureInfo.InvariantCulture = new ss.CultureInfo('en-US',
    {
        naNSymbol: 'NaN',
        negativeSign: '-',
        positiveSign: '+',
        negativeInfinityText: '-Infinity',
        positiveInfinityText: 'Infinity',
        
        percentSymbol: '%',
        percentGroupSizes: [3],
        percentDecimalDigits: 2,
        percentDecimalSeparator: '.',
        percentGroupSeparator: ',',
        percentPositivePattern: '{0} %',
        percentNegativePattern: '-{0} %',

        currencySymbol:'$',
        currencyGroupSizes: [3],
        currencyDecimalDigits: 2,
        currencyDecimalSeparator: '.',
        currencyGroupSeparator: ',',
        currencyNegativePattern: '(${0})',
        currencyPositivePattern: '${0}',

        numberGroupSizes: [3],
        numberDecimalDigits: 2,
        numberDecimalSeparator: '.',
        numberGroupSeparator: ','
    },
    {
        amDesignator: 'AM',
        pmDesignator: 'PM',

        dateSeparator: '/',
        timeSeparator: ':',

        gmtDateTimePattern: 'ddd, dd MMM yyyy HH:mm:ss \'GMT\'',
        universalDateTimePattern: 'yyyy-MM-dd HH:mm:ssZ',
        sortableDateTimePattern: 'yyyy-MM-ddTHH:mm:ss',
        dateTimePattern: 'dddd, MMMM dd, yyyy h:mm:ss tt',

        longDatePattern: 'dddd, MMMM dd, yyyy',
        shortDatePattern: 'M/d/yyyy',

        longTimePattern: 'h:mm:ss tt',
        shortTimePattern: 'h:mm tt',

        firstDayOfWeek: 0,
        dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
        shortDayNames: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
        minimizedDayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'],

        monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December',''],
        shortMonthNames: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec','']
    });
ss.CultureInfo.CurrentCulture = ss.CultureInfo.InvariantCulture;

///////////////////////////////////////////////////////////////////////////////
// IEnumerator

ss.IEnumerator = function IEnumerator$() { };
ss.IEnumerator.prototype = {
    get_current: null,
    moveNext: null,
    reset: null
}

ss.IEnumerator.getEnumerator = function ss_IEnumerator$getEnumerator(enumerable) {
    if (enumerable) {
        return enumerable.getEnumerator ? enumerable.getEnumerator() : new ss.ArrayEnumerator(enumerable);
    }
    return null;
}

ss.IEnumerator.registerInterface('IEnumerator');

///////////////////////////////////////////////////////////////////////////////
// IEnumerable

ss.IEnumerable = function IEnumerable$() { };
ss.IEnumerable.prototype = {
    getEnumerator: null
}
ss.IEnumerable.registerInterface('IEnumerable');

///////////////////////////////////////////////////////////////////////////////
// ArrayEnumerator

ss.ArrayEnumerator = function ArrayEnumerator$(array) {
    this._array = array;
    this._index = -1;
    this.current = null;
}
ss.ArrayEnumerator.prototype = {
    moveNext: function ArrayEnumerator$moveNext() {
        this._index++;
        this.current = this._array[this._index];
        return (this._index < this._array.length);
    },
    reset: function ArrayEnumerator$reset() {
        this._index = -1;
        this.current = null;
    }
}

ss.ArrayEnumerator.registerClass('ArrayEnumerator', null, ss.IEnumerator);

///////////////////////////////////////////////////////////////////////////////
// IDisposable

ss.IDisposable = function IDisposable$() { };
ss.IDisposable.prototype = {
    dispose: null
}
ss.IDisposable.registerInterface('IDisposable');

///////////////////////////////////////////////////////////////////////////////
// StringBuilder

ss.StringBuilder = function StringBuilder$(s) {
    this._parts = !ss.isNullOrUndefined(s) ? [s] : [];
    this.isEmpty = this._parts.length == 0;
}
ss.StringBuilder.prototype = {
    append: function StringBuilder$append(s) {
        if (!ss.isNullOrUndefined(s)) {
            this._parts.add(s);
            this.isEmpty = false;
        }
        return this;
    },

    appendLine: function StringBuilder$appendLine(s) {
        this.append(s);
        this.append('\r\n');
        this.isEmpty = false;
        return this;
    },

    clear: function StringBuilder$clear() {
        this._parts = [];
        this.isEmpty = true;
    },

    toString: function StringBuilder$toString(s) {
        return this._parts.join(s || '');
    }
};

ss.StringBuilder.registerClass('StringBuilder');

///////////////////////////////////////////////////////////////////////////////
// EventArgs

ss.EventArgs = function EventArgs$() {
}
ss.EventArgs.registerClass('EventArgs');

ss.EventArgs.Empty = new ss.EventArgs();

///////////////////////////////////////////////////////////////////////////////
// XMLHttpRequest

if (!window.XMLHttpRequest) {
    window.XMLHttpRequest = function() {
        var progIDs = [ 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP' ];

        for (var i = 0; i < progIDs.length; i++) {
            try {
                var xmlHttp = new ActiveXObject(progIDs[i]);
                return xmlHttp;
            }
            catch (ex) {
            }
        }

        return null;
    }
}

///////////////////////////////////////////////////////////////////////////////
// XmlDocumentParser

ss.parseXml = function(markup) {
    try {
        if (DOMParser) {
            var domParser = new DOMParser();
            return domParser.parseFromString(markup, 'text/xml');
        }
        else {
            var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
        
            for (var i = 0; i < progIDs.length; i++) {
                var xmlDOM = new ActiveXObject(progIDs[i]);
                xmlDOM.async = false;
                xmlDOM.loadXML(markup);
                xmlDOM.setProperty('SelectionLanguage', 'XPath');
                
                return xmlDOM;
            }
        }
    }
    catch (ex) {
    }

    return null;
}

///////////////////////////////////////////////////////////////////////////////
// CancelEventArgs

ss.CancelEventArgs = function CancelEventArgs$() {
    ss.CancelEventArgs.initializeBase(this);
    this.cancel = false;
}
ss.CancelEventArgs.registerClass('CancelEventArgs', ss.EventArgs);

///////////////////////////////////////////////////////////////////////////////
// Tuple

ss.Tuple = function (first, second, third) {
  this.first = first;
  this.second = second;
  if (arguments.length == 3) {
    this.third = third;
  }
}
ss.Tuple.registerClass('Tuple');

///////////////////////////////////////////////////////////////////////////////
// Observable

ss.Observable = function(v) {
    this._v = v;
    this._observers = null;
}
ss.Observable.prototype = {

  getValue: function () {
    this._observers = ss.Observable._captureObservers(this._observers);
    return this._v;
  },
  setValue: function (v) {
    if (this._v !== v) {
      this._v = v;

      var observers = this._observers;
      if (observers) {
        this._observers = null;
        ss.Observable._invalidateObservers(observers);
      }
    }
  }
};

ss.Observable._observerStack = [];
ss.Observable._observerRegistration = {
  dispose: function () {
    ss.Observable._observerStack.pop();
  }
}
ss.Observable.registerObserver = function (o) {
  ss.Observable._observerStack.push(o);
  return ss.Observable._observerRegistration;
}
ss.Observable._captureObservers = function (observers) {
  var registeredObservers = ss.Observable._observerStack;
  var observerCount = registeredObservers.length;

  if (observerCount) {
    observers = observers || [];
    for (var i = 0; i < observerCount; i++) {
      var observer = registeredObservers[i];
      if (!observers.contains(observer)) {
        observers.push(observer);
      }
    }
    return observers;
  }
  return null;
}
ss.Observable._invalidateObservers = function (observers) {
  for (var i = 0, len = observers.length; i < len; i++) {
    observers[i].invalidateObserver();
  }
}

ss.Observable.registerClass('Observable');


ss.ObservableCollection = function (items) {
  this._items = items || [];
  this._observers = null;
}
ss.ObservableCollection.prototype = {

  get_item: function (index) {
    this._observers = ss.Observable._captureObservers(this._observers);
    return this._items[index];
  },
  set_item: function (index, item) {
    this._items[index] = item;
    this._updated();
  },
  get_length: function () {
    this._observers = ss.Observable._captureObservers(this._observers);
    return this._items.length;
  },
  add: function (item) {
    this._items.push(item);
    this._updated();
  },
  clear: function () {
    this._items.clear();
    this._updated();
  },
  contains: function (item) {
    return this._items.contains(item);
  },
  getEnumerator: function () {
    this._observers = ss.Observable._captureObservers(this._observers);
    return this._items.getEnumerator();
  },
  indexOf: function (item) {
    return this._items.indexOf(item);
  },
  insert: function (index, item) {
    this._items.insert(index, item);
    this._updated();
  },
  remove: function (item) {
    if (this._items.remove(item)) {
      this._updated();
      return true;
    }
    return false;
  },
  removeAt: function (index) {
    this._items.removeAt(index);
    this._updated();
  },
  toArray: function () {
    return this._items;
  },
  _updated: function() {
    var observers = this._observers;
    if (observers) {
      this._observers = null;
      ss.Observable._invalidateObservers(observers);
    }
  }
}
ss.ObservableCollection.registerClass('ObservableCollection', null, ss.IEnumerable);

///////////////////////////////////////////////////////////////////////////////
// Interfaces

ss.IApplication = function() { };
ss.IApplication.registerInterface('IApplication');

ss.IContainer = function () { };
ss.IContainer.registerInterface('IContainer');

ss.IObjectFactory = function () { };
ss.IObjectFactory.registerInterface('IObjectFactory');

ss.IEventManager = function () { };
ss.IEventManager.registerInterface('IEventManager');

ss.IInitializable = function () { };
ss.IInitializable.registerInterface('IInitializable');


// ThemeYoshi.js
(function(){
Type.registerNamespace('Theme');SiteTheme=function(){}
TopBarTheme=function(){}
MagneticListPageTheme=function(){}
MagneticListTheme=function(){}
EmailTheme=function(){}
UserTheme=function(){}
SiteTheme.registerClass('SiteTheme');TopBarTheme.registerClass('TopBarTheme');MagneticListPageTheme.registerClass('MagneticListPageTheme');MagneticListTheme.registerClass('MagneticListTheme');EmailTheme.registerClass('EmailTheme');UserTheme.registerClass('UserTheme');SiteTheme.localHost='192.168.1.19';SiteTheme.testing=true;SiteTheme.siteTitle='Yes Play Love';SiteTheme.simulatedLatency=(window.location.hostname.indexOf('192.168.1.19')>=0)?600:0;SiteTheme.slideDown=250;SiteTheme.slideUp=250;SiteTheme.fadeIn=250;SiteTheme.fadeOut=250-100;TopBarTheme.saved='saved';TopBarTheme.unsaved='unsaved';TopBarTheme.homeBtnText='Home';TopBarTheme.emailBtnText='Email';TopBarTheme.magneticListBtnText='List';TopBarTheme.profileVis='Your Profile';MagneticListPageTheme.logoImage='images/Common/YoshiAction.jpg';MagneticListPageTheme.pageTitle='YoshiMate Magnetic List';MagneticListTheme.bubbleTopic='Magnetic Bubble';MagneticListTheme.emailTopic='Email';MagneticListTheme.deleteListTitle='Delete this list';MagneticListTheme.newListTitle='Create a new list';MagneticListTheme.deleteItemTitle='Delete this item';EmailTheme.inboxTitle='Inbox';EmailTheme.messageTitle='Message';EmailTheme.replyTitle='Reply';EmailTheme.sendButton='send';EmailTheme.replyButton='reply';EmailTheme.pageTitle='YesPlayLove Email';UserTheme.pageTitle='YesPlayLove Profile';})();// This script was generated using Script# v0.7.4.0


// Nsb.js
(function(){
jQuery.fn.expando=function(customOptions){var $0='&#x25C4;';var $1='&#x25BA;';var $2='&#x25BC;';var $3='expandoPluginMark';var $4={side:'left',initiallyClosed:true,fullSurface:false};var $5=$.extend({},$4,customOptions);if(ss.isNullOrUndefined($5.openMark)){$5.openMark=$2;}if(ss.isNullOrUndefined($5.closedMark)){$5.closedMark=($5.side==='left')?$1:$0;}return this.each(function($p1_0,$p1_1){
var $1_0=$('<span/>').css({color:'#008',padding:(($5.side==='left')?'0 5px 0 0':'0 0 0 5px')}).addClass($3).html(($5.initiallyClosed)?$5.closedMark:$5.openMark);$5.clickOpen=function($p2_0){
$(this).unbind('click').click($5.clickClosed).closest('dl').children('dd').show();$(this).parent().find('.'+$3).html($5.openMark);$p2_0.stopImmediatePropagation();$p2_0.preventDefault();};$5.clickClosed=function($p2_0){
$(this).unbind('click').click($5.clickOpen).closest('dl').children('dd').hide();$(this).parent().find('.'+$3).html($5.closedMark);$p2_0.stopImmediatePropagation();$p2_0.preventDefault();};if($5.side==='left'){$1_0.prependTo($(this).children('dt'));}else{$1_0.appendTo($(this).children('dt'));}(($5.fullSurface)?$1_0.parent():$1_0).click(function($p2_0){
var $2_0=$(this).closest('dt').next('dd');if($2_0.is(':visible')){($5.clickClosed).call(this,$p2_0);}else{($5.clickOpen).call(this,$p2_0);}}).css('cursor','pointer');if($5.initiallyClosed){$(this).children('dd').hide();}else{$(this).children('dd').show();}});}
Type.registerNamespace('Nsb');Nsb.Nsb$0=function(){Nsb.Nsb$0.initializeBase(this);}
Nsb.Nsb$0.prototype={$1_0:function(){QUnit.expect(2);QUnit.ok(true,'Hello');var $0=0;var $1=new Await().que(function($p1_0){
window.setTimeout(function(){
QUnit.ok(false,'Await 1');Inform.log('Await 1');$p1_0.set_item('aw1','1');$p1_0.done();},200);}).que(function($p1_0){
Inform.log('Await 2');$p1_0.doneWith('aw2','2');}).addDl(function($p1_0){
window.setTimeout(function(){
Inform.log('Await 3');$p1_0.doneWith('aw3','3');},200);}).addDl(function($p1_0){
Inform.log('Await 4 throw');$p1_0.set_item('aw4','4');if($p1_0.get_item('aw4')==='4'){throw new Error('xxx exception');}$p1_0.done();}).handle('xxx exception',function($p1_0){
Inform.log('Await handler');$p1_0.set_item('aw4','thrown');}).addDl(function($p1_0){
Inform.log('Await 5');$p1_0.doneWith('aw5','5');}).deferred(function($p1_0){
Inform.log('Await Deferred {0}, {1}, {2}, {3}',$p1_0.get_item('aw1'),$p1_0.get_item('aw2'),$p1_0.get_item('aw3'),$p1_0.get_item('aw4'));Inform.log('.............. {0}',$p1_0.get_item('aw5'));if(!$0++){$p1_0.commit();}}).commit();},$1_1:function(){QUnit.stop();}}
DynamicCss=function(){}
DynamicCss.addCssRule=function(ruleName,rules){var $0='AddCssRuleData';var $1=window.self.jQuery;var $2=$1[$0];if(typeof($2)==='undefined'){$2={};$2.sheetName='DynamicCss-StyleSheet';$2.undefined_as_dictionary=undefined;$1[$0]=$2;var $3=document.createElement('style');$3.id=new Date().getTime().toString();$3.type='text/css';$3.rel='stylesheet';$3.media='screen';$3.title=$2.sheetName;document.getElementsByTagName('head')[0].appendChild($3);}if(('styleSheets' in window.document)){if(typeof(rules)==='undefined'){var $4=window.document.styleSheets;for(var $5=0;$5<$4.length;$5++){var $6=null;try{var $7=$4[$5];if($7.title!==$2.sheetName){continue;}if((typeof($7.insertRule)==='function')){var $8=$7.insertRule(ruleName+' { }',0);$6=$7.cssRules[$8];}else if((typeof($7.addRule)==='function')){$7.addRule(ruleName,null,0);$6=$7.rules[0];}else{throw new Error('CANT FIND insertRule OR SIMILAR CSS FUNCTION');}}catch($9){}return $6;}throw new Error('FAILED TO ADD CSS RULE or NO DynamicCss SHEET');}$(DynamicCss.addCssRule(ruleName,$2.undefined_as_dictionary)).css(rules);return null;}throw new Error('NO BROWSER DYNAMIC STYLESHEET SUPORT');}
Nsb.Encoder=function(){}
Nsb.Encoder.lzwEncode=function(s){return Encoder.LzwEncode(s);}
Nsb.Encoder.lzwDecode=function(s){return Encoder.LzwDecode(s);}
Nsb.Encoder.encode64=function(s){return Encoder.Encode64(s);}
Nsb.Encoder.decode64=function(s){return Encoder.Decode64(s);}
Sleep=function(){}
Sleep.delay=function(fn,ms){window.setTimeout(fn,ms);}
Sleep.doNow=function(fn,ms){fn();}
Sleep.throwDelay=function(fn,ms){window.setTimeout(fn,ms);throw new Error('Delay finish throw out');}
Sleep.wait=function(fn,condition,startTime){if(condition()){fn();return;}if(ss.isNullOrUndefined(startTime)){startTime=new Date().getTime();}if(new Date().getTime()-startTime>40000){throw new Error('Max wait time exceeded');}window.setTimeout(function(){
Sleep.wait(fn,condition,startTime);},13);}
Nsb.Storage=function(){}
Nsb.Storage.setLocal=function(n,v){Nsb.Storage.$0(n,v,window.localStorage);}
Nsb.Storage.setSession=function(n,v){Nsb.Storage.$0(n,v,window.sessionStorage);}
Nsb.Storage.getLocal=function(n){return Nsb.Storage.$1(n,window.localStorage);}
Nsb.Storage.getSession=function(n){return Nsb.Storage.$1(n,window.sessionStorage);}
Nsb.Storage.removeLocal=function(n){try{window.localStorage.removeItem(n);}catch($0){window.localStorage[n]='';}}
Nsb.Storage.removeSession=function(n){try{window.sessionStorage.removeItem(n);}catch($0){window.sessionStorage[n]='';}}
Nsb.Storage.compareLocal=function(n,v){return Nsb.Storage.compareObjects(Nsb.Storage.$1(n,window.localStorage),v);}
Nsb.Storage.compareObjects=function(a,b){if(ss.isNullOrUndefined(a)||ss.isNullOrUndefined(b)){return false;}return JSON.stringify(a)===JSON.stringify(b);}
Nsb.Storage.$0=function($p0,$p1,$p2){switch(typeof($p1)){case 'object':$p1='@@object@@'+Nsb.Storage.ultraStringify($p1);break;default:$p1=$p1.toString();break;}$p2.setItem($p0,$p1);}
Nsb.Storage.$1=function($p0,$p1){var $0=$p1.getItem($p0);if(ss.isNull($0)){return undefined;}if(new RegExp('^@@object@@').test($0)){try{return eval('('+$0.substr(10)+')');}catch($1){Inform.log('Syntax error parsing stored "'+$p0+'" object: '+$1);}return undefined;}return Nsb.Storage.stringValue($0);}
Nsb.Storage.stringValue=function(v){switch(v){case 'true':return true;case 'false':return false;case 'null':return null;case 'undefined':return undefined;}return v;}
Nsb.Storage.ultraStringify=function(item){return JSON.stringify(item,function($p1_0,$p1_1){
return (typeof($p1_1)==='function')?$p1_1.toString():$p1_1;});}
Transform=function(){}
Transform.htmlize=function(txt,pass){if(pass){return txt;}var $0='';var $1;for(var $2=0;$2<txt.length;$2++){$1=txt.substr($2,1);switch($1){case '<':$0+='&lt;';break;case '>':$0+='&gt;';break;case '&':$0+='&amp;';break;case '\n':$0+='<br/>';break;case ' ':$0+='&nbsp;';break;default:$0+=$1;break;}}return $0;}
Type.registerNamespace('Nsb.Classes');Actor=function(){Actor.initializeBase(this);}
Actor.$7=function($p0,$p1,$p2,$p3,$p4){return $p3*Math.sin($p1/$p4*3*4*(Math.PI/2))+$p2;}
Actor.prototype={acting:false,fadeIn:200,fadeOut:200,followDelegate:null,followTmr:0,isFollowable:true,mouseX:0,mouseY:0,trackingDone:false,followMouse:function(){this.unfollowMouse();this.followDelegate=ss.Delegate.create(this,function($p1_0){
this.mouseY=$p1_0.pageY;this.mouseX=$p1_0.pageX;});$(window.self).bind('mousemove.actor',this.followDelegate);this.$8();this.startActing();return this;},unfollowMouse:function(){this.resetTimers();if(this.followDelegate!=null){$(window.self).unbind('mousemove.actor');this.followDelegate=null;}return this;},shake:function(ms){if(this.acting){return this;}this.acting=true;ms=(ms||200);jQuery.easing.shaker = Actor.$7;var $0=this.element.position();this.element.css($0);var $1={top:$0.top+5+'px',left:$0.left+5+'px'};var $2={duration:ms,easing:'shaker',complete:ss.Delegate.create(this,function(){
this.element.css($0);})};new Await().addAw(ss.Delegate.create(this,this.$6),$1,$2).addDx(ss.Delegate.create(this,function(){
this.acting=false;})).commit();return this;},$6:function($p0,$p1,$p2){var $0=($p2||{});var $1=($p1||{});var $2=($0['complete']||function(){
});$0['complete']=function(){
$2();$p0.done();};this.element.animate($1,$0);},resetTimers:function(){window.clearTimeout(this.followTmr);this.followTmr=0;},$8:function(){this.isFollowable=true;},startActing:function(){this.acting=true;this.trackingDone=false;this.followTmr=window.setTimeout(ss.Delegate.create(this,this.follow),1);this.element.fadeIn(this.fadeIn);},follow:function(){window.clearTimeout(this.followTmr);this.element.css('top',this.mouseY+'px').css('left',this.mouseX+'px');this.followTmr=window.setTimeout(ss.Delegate.create(this,this.follow),30);},waitTrackingDoneAw:function(awp){if(!this.trackingDone){window.setTimeout(ss.Delegate.create(this,function(){
this.waitTrackingDoneAw(awp);}),50);return;}awp.done();}}
Alert=function(){Alert.initializeBase(this);}
Alert.ask=function(msg,a1,a2,a3,a4){Notify.notifyBox(String.format(msg,a1,a2,a3,a4)).element.appendTo(document.body).fadeIn(250);}
Alert.askAw=function(awp,msgOrProperties){Notify.notifyBox(msgOrProperties).Awp(awp).element.appendTo(document.body).fadeIn(250);}
Alert.get_alertBtnCss=function(){return new CssRules().add('.<class> > div > button',{position:'absolute',width:'90px',bottom:'20px'}).add('.<class> > div > button.<class>Ok',{left:'50%',marginLeft:'-45px'}).add('.<class> > div > button.<class>Skip',{display:'none'}).add('.<class> > div > button.<class>Cancel',{display:'none'});}
Await=function(){this.$0=[];}
Await.abortAw=function(aw){aw.abort();}
Await.prototype={$1:false,$2:null,$3:0,$4:null,$5:null,$6:null,$7:0,$8:null,$9:null,$A:null,get_awp:function(){return this.$2;},que:function(fn){if(this.$6==null){this.$6=[];}this.$6.add(ss.Delegate.create(this,function($p1_0){
this.$10(fn);if(Inform.passExceptions){fn($p1_0);return;}try{fn($p1_0);}catch($1_0){this.$C($1_0);}}));this.$3++;this.$7++;return this;},addDl:function(fn){if(this.$9==null){this.$9=[];}this.$9.add(ss.Delegate.create(this,function($p1_0){
this.$10(fn);if(Inform.passExceptions){fn($p1_0);return;}try{fn($p1_0);}catch($1_0){this.$C($1_0);}}));this.$3++;return this;},addDx:function(fn){if(this.$9==null){this.$9=[];}this.$9.add(ss.Delegate.create(this,function($p1_0){
this.$10(fn);if(Inform.passExceptions){fn($p1_0);$p1_0.done();return;}try{fn($p1_0);$p1_0.done();}catch($1_0){this.$C($1_0);}}));this.$3++;return this;},addAw:function(fn,arg1,arg2,arg3){if(this.$9==null){this.$9=[];}this.$9.add(ss.Delegate.create(this,function($p1_0){
this.$10(fn,arg1,arg2,arg3);if(Inform.passExceptions){fn($p1_0,arg1,arg2,arg3);return;}try{fn($p1_0,arg1,arg2,arg3);}catch($1_0){this.$C($1_0);}}));this.$3++;return this;},queFn:function(fn){this.que(ss.Delegate.create(this,function($p1_0){
this.$10(fn);if(Inform.passExceptions){fn();$p1_0.done();return;}try{fn();$p1_0.done();}catch($1_0){this.$C($1_0);}}));return this;},addFn:function(fn,arg1,arg2){if(this.$9==null){this.$9=[];}this.$9.add(ss.Delegate.create(this,function($p1_0){
this.$10(fn,arg1,arg2);if(Inform.passExceptions){fn(arg1,arg2);$p1_0.done();return;}try{fn(arg1,arg2);$p1_0.done();}catch($1_0){this.$C($1_0);}}));this.$3++;return this;},doneWith:function(n,v){this.$A[n]=v;this.done();},done:function(){if(this.$1){return this.$D();}if(this.$0.length>0){var $0=this.$0[this.$0.length-1];this.$0.removeAt(this.$0.length-1);Inform.trace('Done: '+$0);}this.$3--;this.$7--;return this.$B();},$B:function(){if(this.$1){return this.$D();}var $0=this;if(this.$7<=0&&this.$3>0){var $1=this.$8[0];this.$8.removeAt(0);window.setTimeout(function(){
$1($0);},1);return this;}if(this.$3<=0){window.setTimeout(ss.Delegate.create(this,function(){
if(ss.isValue(this.$4)){this.$4($0);}if(ss.isValue(this.$2)){this.$2.done();}}),1);}return this;},deferred:function(fn){this.$4=fn;return this;},handle:function(exceptionName,fn){if(this.$5==null){this.$5={};}this.$5[exceptionName]=fn;return this;},$C:function($p0){var $0=(ss.isValue($p0.message))?$p0.message:'none';if(this.$5!=null&&Object.keyExists(this.$5,$0)){var $1=this.$5[$0];$1(this);this.done();return;}switch($0){case 'FBDone':this.abort();return;default:Inform.error('Await Exception: "{0}"',$p0.message);throw $p0;}},abort:function(){this.$1=true;return this;},$D:function(){if(this.$2!=null){this.$2.abort().done();}return this;},sleep:function(ms){return this.addDl(ss.Delegate.create(this,function(){
window.setTimeout(ss.Delegate.create(this,function(){
this.done();}),ms);}));},simulateAsync:function(){return this.addDl(ss.Delegate.create(this,function(){
window.setTimeout(ss.Delegate.create(this,function(){
this.done();}),SiteTheme.simulatedLatency);}));},commit:function(awp){this.$2=(ss.isValue(awp))?awp:null;this.$A={};if(this.$9!=null){this.$8=this.$9.clone();}this.$7=(this.$6==null)?0:this.$6.length;this.$3=(this.$8==null)?0:this.$8.length+this.$7;return this.$E();},$E:function(){if(this.$7>0){var $enum1=ss.IEnumerator.getEnumerator(this.$6);while($enum1.moveNext()){var $0=$enum1.current;if(this.$1){return this.$D();}this.$F($0);}}else{this.$B();}return this;},$F:function($p0){var $0=this;window.setTimeout(function(){
$p0($0);},1);},trace:function(msg){Inform.trace('Started: '+msg);this.$0.add(msg);},test:function(){var $0=new Nsb.Nsb$0();$0.$1_0();},$10:function($p0,$p1,$p2,$p3){if(!Inform.logActions){return;}var $0=$p0._targets;if(ss.isValue($0)){var $1='()';if(ss.isValue($p1)){$1=String.format('({0},{1},{2})',$p1,$p2,$p3);}if($0.length>1&&ss.isValue($0[1])){var $2=$p0._targets[1].name;if(ss.isValue($2)&&!String.isNullOrEmpty($2)){Inform.log('Await doing {0}{1}',$2,$1);}else{$2=Type.getInstanceType($p0._targets[0]).get_name();Inform.log('Await doing (anonymous delegate){0}{1}',$2,$1);}}}},get_item:function(n){return this.$A[n];},set_item:function(n,value){this.$A[n]=value;return value;}}
Cluster=function(){Cluster.initializeBase(this);}
Cluster.combineCssRules=function(rules1,rules2,rules3,rules4){var $0=new CssRules();$.extend($0.rules,rules1.rules,rules2.rules,(ss.isValue(rules3))?rules3.rules:Constants.undefined,(ss.isValue(rules4))?rules4.rules:Constants.undefined);return $0;}
Cluster.hider=function(hiderOn){if(hiderOn){if(Cluster.$3++>0){return;}Cluster.$2=$('<div/>').appendTo(document.body).css({position:'absolute',top:0,left:0,width:DomElement.documentWidth(),height:DomElement.documentHeight(),margin:0,padding:0,background:'#AAA',opacity:0.75,zIndex:999}).show();}else{if(--Cluster.$3>0){return;}var $0=Cluster.$2;Cluster.$2=null;$0.fadeOut(200,function(){
$0.remove();});}}
Cluster.hash=function(s){var $0=0;for(var $1=0;$1<s.length;$1++){$0+=(s.charCodeAt($1)*($1+1));}return Math.abs($0);}
Cluster.prototype={AwpAction:null,ClassName:null,$4:null,FnDelegate:null,get_Css:function(){return null;},set_Css:function(value){this.xCss(value);return value;},$5:function($p0){var $0=this.ClassName;var $1=0;if(ss.isNullOrUndefined(Cluster.$1)){Cluster.$1={};}if(ss.isNullOrUndefined(this.ClassName)){var $dict1=$p0.rules;for(var $key2 in $dict1){var $2={key:$key2,value:$dict1[$key2]};$1+=Cluster.hash($2.key+JSON.stringify($2.value))*3.141592654;}$0=this.ClassName=('HxH'+$1).replaceAll('.','X');}Inform.trace('Creating rules with ClassName={0}',$0);var $dict3=$p0.rules;for(var $key4 in $dict3){var $3={key:$key4,value:$dict3[$key4]};var $4=$3.key.replaceAll('<class>',$0);if(!Object.keyExists(Cluster.$1,$4)){Cluster.$1[$4]=$3.value;DynamicCss.addCssRule($4,$3.value);Inform.trace('Adding rule {0}',JSON.stringify($4));}}},xCss:function(css1,css2,css3){if(ss.isNullOrUndefined(this.$4)){this.$4=new CssRules();}if(ss.isValue(css1)){$.extend(this.$4.rules,css1.rules);}if(ss.isValue(css2)){$.extend(this.$4.rules,css2.rules);}if(ss.isValue(css3)){$.extend(this.$4.rules,css3.rules);}return this;},Class:function(name){this.ClassName=name;return this;},Awp:function(awp){this.AwpAction=awp;return this;},Action:function(fnDelegate){this.FnDelegate=fnDelegate;return this;},tryLoadProperties:function(properties){if(typeof(properties)==='object'){if(ss.isValue(properties)){var $dict1=properties;for(var $key2 in $dict1){var $0={key:$key2,value:$dict1[$key2]};try{var $1=this;$1[$0.key]=$0.value;}catch($2){throw new Error('Undefined Notify Property ['+$0.key+']');}}}return true;}return false;}}
Exceptions=function(){}
Exceptions.get_notImplementedException=function(){return new Error('Not Implimented');}
FileBlobBase=function(){}
FileBlobBase.prototype={retrievePkgBlobAw:function(awp,partitionKey,rowKey,rxKey){new Await().addDx(ss.Delegate.create(this,function($p1_0){
this.retrievePkgStringAw($p1_0,partitionKey,rowKey,rxKey);})).addDx(ss.Delegate.create(this,function($p1_0){
$p1_0.set_item(rxKey,this.$7($p1_0.get_item(rxKey)));})).handle('Invalid Pkg Blob',Await.abortAw).commit(awp);},storePkgBlobAw:function(awp,partitionKey,rowKey,rxKey,blob){new Await().addDx(ss.Delegate.create(this,function($p1_0){
this.storePkgStringAw($p1_0,partitionKey,rowKey,rxKey,this.$6(blob));})).addDx(function($p1_0){
awp.set_item(rxKey,$p1_0.get_item(rxKey));}).commit(awp);},retrievePkgStringAw:function(awp,partitionKey,rowKey,rxKey){var $0={};$0['password']='SuperBaby';$0['path']=partitionKey;$0['file']=rowKey+'.txt';var $1={};$1.url='data/file.get.phpx';$1.data=$0;$1.dataType='jsonp';$1.type='GET';$1.success=ss.Delegate.create(this,function($p1_0,$p1_1,$p1_2){
try{if(ss.isNullOrUndefined($p1_0)||!$p1_0.result){throw new Error('Invalid Pkg Blob');}awp.set_item(rxKey,this.$9($p1_0.content));}catch($1_0){Inform.warn('Unable to retrieve pkg {0}/{1}, exception={3}',partitionKey,rowKey,$1_0);throw new Error('Invalid Pkg Blob');}awp.done();});$1.error=function($p1_0,$p1_1,$p1_2){
debugger;console.error('WTF?');Inform.error('Error retrieving pkg {0}/{1}, {3} : {4}',partitionKey,rowKey,$p1_2,$p1_0.responseText);throw new Error('Invalid Pkg Blob');};$.ajax($1);},storePkgStringAw:function(awp,partitionKey,rowKey,rxKey,content){var $0=this.$8(content);var $1={};$1['password']='SuperBaby';$1['createFile']='true';$1['createPath']='true';$1['path']=partitionKey;$1['file']=rowKey+'.txt';$1['content']=$0;var $2={};$2.url='data/file.put.php';$2.data=$1;$2.type='POST';$2.success=function($p1_0,$p1_1,$p1_2){
if(!$p1_0.result){awp.set_item(rxKey,false);awp.done();return;}awp.set_item(rxKey,true);awp.done();};$2.error=function($p1_0,$p1_1,$p1_2){
Inform.error('Error storing blob ='+$p1_1+' : '+$p1_2+' : '+$p1_0.responseText);awp.set_item(rxKey,null);awp.abort();};$.ajax($2);},appendPkgStringAw:function(awp,partitionKey,rowKey,rxKey,content){var $0={};$0['password']='SuperBaby';$0['createFile']='true';$0['createPath']='true';$0['path']=partitionKey;$0['file']=rowKey+'.txt';$0['content']=content;var $1={};$1.url='data/file.append.php';$1.data=$0;$1.type='POST';$1.success=function($p1_0,$p1_1,$p1_2){
try{if(ss.isNullOrUndefined($p1_0)||!$p1_0.result){awp.set_item(rxKey,false);awp.done();return;}}catch($1_0){Inform.warn('Not able to append pkg {0}/{1}, error={3}',partitionKey,rowKey,$1_0);awp.set_item(rxKey,false);awp.done();return;}awp.set_item(rxKey,true);awp.done();};$1.error=function($p1_0,$p1_1,$p1_2){
Inform.error('Error storing blob ='+$p1_1+' : '+$p1_2+' : '+$p1_0.responseText);awp.set_item(rxKey,false);awp.done();};$.ajax($1);},$6:function($p0){return this.$8(JSON.stringify($p0));},$7:function($p0){if(!String.isNullOrEmpty($p0)){return JSON.parse(this.$9($p0));}return '';},$8:function($p0){return $p0;},$9:function($p0){var $0=(ss.isNullOrUndefined($p0))?'':$p0.substr(0,6);switch($0){case 'VXLZ64':return Nsb.Encoder.lzwDecode(Nsb.Encoder.decode64($p0.substr(6)));default:return (String.isNullOrEmpty($p0))?'':$p0;}}}
Nsb.Classes.Truple=function(){Nsb.Classes.Truple.initializeBase(this);}
Nsb.Classes.Truple.prototype={input:function(classNames,tu){return new Nsb.Classes.Truple().fromHtml("<div class='Truple'/>").addClass(classNames).appendTo(tu).append($("<span class='Label'/>")).append($("<input type='text' class='Input'/>"));},checkbox:function(classNames,tu){return new Nsb.Classes.Truple().fromHtml("<div class='Truple'/>").addClass(classNames).appendTo(tu).append($("<span class='Label'/>")).append($("<input type='checkbox' class='Input'/>"));},selectBox:function(classNames,tu){return new Nsb.Classes.Truple().fromHtml("<div class='Truple'/>").addClass(classNames).appendTo(tu).append($("<span class='Label'/>")).append($("<select class='Input'/>"));},subHtml:function(s,html){this.select(s).html(html);return this;},subAttr:function(s,attr,value){this.select(s).attr(attr,value);return this;},subOptions:function(s,items){var $0=this.select(s);var $dict1=items;for(var $key2 in $dict1){var $1={key:$key2,value:$dict1[$key2]};$0.append($('<option/>').attr('value',$1.key).html($1.value));}return this;},div:function(classNames,el){return new Nsb.Classes.Truple().fromHtml('<div/>').addClass(classNames).appendTo(el);},textarea:function(classNames,el){return new Nsb.Classes.Truple().fromHtml('<textarea/>').addClass(classNames).appendTo(el);}}
DomElement=function(){}
DomElement.isValidName=function(name){return !String.isNullOrEmpty(DomElement.cleanName(name));}
DomElement.isValidNames=function(name1,name2){return DomElement.isValidName(name1)&&DomElement.isValidName(name2);}
DomElement.cleanName=function(name){return (ss.isNullOrUndefined(name))?'':name.trim();}
DomElement.cancelEvent=function(e){e.stopImmediatePropagation();e.stopPropagation();e.preventDefault();}
DomElement.newLink=function(face,url){var $0=$('<a/>').attr('href',url).html(face);return $0;}
DomElement.windowWidth=function(){return DomElement.$0((ss.isValue(window.self.innerWidth))?window.self.innerWidth:0,(ss.isValue(document.documentElement))?document.documentElement.clientWidth:0,(ss.isValue(document.body))?document.body.clientWidth:0);}
DomElement.windowHeight=function(){return DomElement.$0((ss.isValue(window.self.innerHeight))?window.self.innerHeight:0,(ss.isValue(document.documentElement))?document.documentElement.clientHeight:0,(ss.isValue(document.body))?document.body.clientHeight:0);}
DomElement.documentWidth=function(){return $(document.documentElement).width();}
DomElement.documentHeight=function(){return $(document.documentElement).height();}
DomElement.documentScrollLeft=function(){return DomElement.$0((ss.isValue(window.self.pageXOffset))?window.self.pageXOffset:0,(ss.isValue(document.documentElement))?document.documentElement.scrollLeft:0,(ss.isValue(document.body))?document.body.scrollLeft:0);}
DomElement.documentScrollTop=function(){return DomElement.$0((ss.isValue(window.self.pageYOffset))?window.self.pageYOffset:0,(ss.isValue(document.documentElement))?document.documentElement.scrollTop:0,(ss.isValue(document.body))?document.body.scrollTop:0);}
DomElement.$0=function($p0,$p1,$p2){var n_result = $p0 ? $p0 : 0; if ($p1 && (!n_result || (n_result > $p1))) n_result = $p1;;return $p2 && (!n_result || (n_result > $p2)) ? $p2 : n_result;;}
DomElement.prototype={append:function(cl){if(cl instanceof jQuery){this.element.append(cl);}else{this.element.append(cl.element);}return this;},appendTo:function(cl){if(cl instanceof jQuery){this.element.appendTo(cl);}else{this.element.appendTo(cl.element);}return this;},addClass:function(classNames){this.element.addClass(classNames);return this;},select:function(s){return $(s,this.element);},element:null,fromHtml:function(html){this.element=$(html);return this;},focusItem:function(selector){$(selector,this.element).focus();},clearElement:function(){if(ss.isValue(this.element)){this.element.empty();}},scrollToAw:function(awp,el){el=(el||this.element);this.scrollToPosAw(awp,el.offset().top-2);},scrollToPosAw:function(awp,y){$('body,html,document').animate({scrollTop:y},300,'swing',function(){
awp.done();});},scrollInViewAw:function(awp,el){if(el==null){awp.done();return;}var $0=DomElement.windowHeight();var $1=$0+DomElement.documentScrollTop();var $2=el.offset().top+el.outerHeight();if($2>$1){this.scrollToPosAw(awp,$2-$0+2);}else{awp.done();}},fadeOutAw:function(awp,ms){ms=(ms||SiteTheme.slideDown);var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.fadeOut(ms,function(){
awp.done();});},fadeInAw:function(awp,ms){ms=(ms||SiteTheme.slideDown);var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.fadeIn(ms,function(){
awp.done();});},slideDownAw:function(awp,ms){ms=(ms||SiteTheme.slideDown);var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.slideDown(ms,function(){
awp.done();});},slideUpAw:function(awp,ms){ms=(ms||SiteTheme.slideDown);var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.slideUp(ms,function(){
awp.done();});},hide:function(){var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.hide();},show:function(){var $0=$('.Jar',this.element);$0=($0.length>0)?$0:this.element;$0.show();},focus:function(el){el=(el||this.element);el.focus();}}
Constants=function(){}
Answer=function(){Answer.initializeBase(this);}
Answer.box=function(msg,a1,a2,a3,a4){Notify.notifyBox(String.format(msg,a1,a2,a3,a4)).element.appendTo(document.body).fadeIn(250);}
Answer.boxAw=function(awp,msgOrProperties){Notify.notifyBox(msgOrProperties).Awp(awp).element.appendTo(document.body).fadeIn(250);}
CssRules=function(){this.rules={};}
CssRules.get_confirmBoxCss=function(){return Cluster.combineCssRules(Notify.get_notifyBoxCss(),CssRules.get_confirmBtnCss());}
CssRules.get_confirmBtnCss=function(){return new CssRules().add('.<class> > div > button',{position:'absolute',width:'90px',bottom:'20px'}).add('.<class> > div > button.<class>Ok',{left:'40px'}).add('.<class> > div > button.<class>Skip',{display:'none'}).add('.<class> > div > button.<class>Cancel',{right:'40px'});}
CssRules.prototype={add:function(rule,prms){this.rules[rule]=prms;return this;}}
Notify=function(){Notify.initializeBase(this);}
Notify.get_notifyBoxCss=function(){return new CssRules().add('.<class>',{display:'none',position:'absolute',top:'20%',left:'50%',width:'450px',height:'200px',marginTop:'0',marginLeft:'-225px',fontFamily:'calibri,helvetica,arial',color:'#006',zIndex:1000}).add('.<class> > div',{position:'absolute',width:'100%',height:'100%',margin:'0',background:'#CFC',border:'8px solid #393','-moz-border-radius':'20px','-webkit-border-radius':'20px','border-radius':'20px'}).add('.<class> > div > h1',{fontSize:'18pt',textAlign:'center'}).add('.<class> > div > p',{fontSize:'14pt',margin:'5px 40px'});}
Notify.notifyBox=function(properties){var $0=new Notify();if(!$0.tryLoadProperties(properties)){$0.Message=properties.toString();}if(ss.isNullOrUndefined($0.$4)){$0.xCss(CssRules.get_confirmBoxCss(),CssRules.get_confirmBtnCss());}$0.$5($0.$4);$0.build();$('.NsbPopUpMsg',$0.element).html($0.Message);$('.NsbPopUpTitle',$0.element).html($0.Title);$('.NsbPopUpOkBtn',$0.element).html($0.OkFace);$('.NsbPopUpSkipBtn',$0.element).html($0.SkipFace);$('.NsbPopUpCancelBtn',$0.element).html($0.CancelFace);window.setTimeout(function(){
var $1_0=String.format("console.log('Element={0}, ScrollTop={1}')",$0.element.offset().top,DomElement.documentScrollTop());eval($1_0);$0.element.css('top',($0.element.offset().top+DomElement.documentScrollTop())+'px');},1);Cluster.hider(true);return $0;}
Notify.requireResultAw=function(awp,required){if(awp.get_item('alertResult')!==required){awp.abort();}awp.done();}
Notify.prototype={CancelFace:'Cancel',Message:'?',OkFace:'OK',SkipFace:'Skip',Title:'',$6:function($p0){var $0=this.element;this.element=null;$0.fadeOut(250,function(){
$0.remove();Cluster.hider(false);});if(ss.isValue(this.AwpAction)){this.AwpAction.doneWith('alertResult',$p0);}else if(ss.isValue(this.FnDelegate)){this.FnDelegate($p0);}},build:function(){Inform.trace('Building with ClassName={0}',this.ClassName);this.ClassName=(ss.isNullOrUndefined(this.ClassName))?'NsbCluster':this.ClassName;this.element=$('<div/>').addClass(this.ClassName+' NsbPopUpBox');var $0=$('<div/>').appendTo(this.element).addClass(this.ClassName+'Inner NsbPopUpInner');$('<h1/>').appendTo($0).addClass(this.ClassName+'Title NsbPopUpTitle');$('<p/>').appendTo($0).addClass(this.ClassName+'Msg NsbPopUpMsg');$('<button/>').appendTo($0).addClass(this.ClassName+'Ok NsbPopUpOkBtn').html('OK').click(ss.Delegate.create(this,function(){
this.$6(true);}));$('<button/>').appendTo($0).addClass(this.ClassName+'Skip NsbPopUpSkipBtn').html('SKIP').click(ss.Delegate.create(this,function(){
this.$6('skip');}));$('<button/>').appendTo($0).addClass(this.ClassName+'Cancel NsbPopUpCancelBtn').html('CANCEL').click(ss.Delegate.create(this,function(){
this.$6(false);}));}}
Request=function(){}
Request.$0=function($p0){var $0={};if($p0.substr(0,1)==='?'){$p0=$p0.substr(1);}var $1=$p0.split('&');if($1.length>0){var $enum1=ss.IEnumerator.getEnumerator($1);while($enum1.moveNext()){var $2=$enum1.current;var $3=$2.split('=');if($3.length===2){$0[$3[0]]=$3[1];}}}return $0;}
Inform=function(){}
Inform.log=function(msg,v1,v2,v3,v4){}
Inform.trace=function(msg,v1,v2,v3,v4){}
Inform.warn=function(msg,v1,v2,v3,v4){}
Inform.error=function(msg,v1,v2,v3,v4){}
Inform.dump=function(item,name){var $0=item;Inform.log('Dump of object "{0}"',(ss.isValue(name))?name:'Type='+Type.getInstanceType(item));var $enum1=ss.IEnumerator.getEnumerator(Object.keys($0));while($enum1.moveNext()){var $1=$enum1.current;Inform.log(String.format('.. {0}={1}',$1,$0[$1]));}}
Inform.logFn=function(args){var $0=args.callee.name;if(!String.isNullOrEmpty($0)){Inform.log('Doing {0}',$0);}}
Nsb.Nsb$0.registerClass('Nsb.Nsb$0');DynamicCss.registerClass('DynamicCss');Nsb.Encoder.registerClass('Nsb.Encoder');Sleep.registerClass('Sleep');Nsb.Storage.registerClass('Nsb.Storage');Transform.registerClass('Transform');DomElement.registerClass('DomElement');Cluster.registerClass('Cluster',DomElement);Actor.registerClass('Actor',Cluster);Notify.registerClass('Notify',Cluster);Alert.registerClass('Alert',Notify);Await.registerClass('Await');Exceptions.registerClass('Exceptions');FileBlobBase.registerClass('FileBlobBase');Nsb.Classes.Truple.registerClass('Nsb.Classes.Truple',Actor);Constants.registerClass('Constants');Answer.registerClass('Answer',Notify);CssRules.registerClass('CssRules');Request.registerClass('Request');Inform.registerClass('Inform');Cluster.classNamePrefix='HxH';Cluster.dClassName='NsbCluster';Cluster.$1=null;Cluster.$2=null;Cluster.$3=0;Exceptions.missingAwaitDoneEr='Missing Await Done Callback';Exceptions.argumentNull='Argument Null';Exceptions.recordNotExists="Record doesn't exist";Exceptions.newRecordExists='Record already exists';Exceptions.invalidName='Invalid Name';Exceptions.invalidPkgBlob='Invalid Pkg Blob';Exceptions.blobSaveError='Blob Save Error';Exceptions.invalidPageExceptionString='Invalid Top Level Page';Exceptions.invalidDataOperation='Invalid Database Operation';Exceptions.notImplementedExceptionString='Not Implimented';Constants.undefined=undefined;Notify.FadeSpeed=250;Request.data=Request.$0(window.location.search);Inform.tracing=false;Inform.passExceptions=false;Inform.logActions=false;})();// This script was generated using Script# v0.7.4.0


// Actors.js
(function(){
Type.registerNamespace('Actors');EyesPoint=function(x,y){this.x=x;this.y=y;}
EyesPoint.prototype={eyesLeft:0,eyesTop:0,leftPupilLeft:0,leftPupilTop:0,rightPupilLeft:0,rightPupilTop:0,x:0,y:0,followable:false,collect:function(eyes){var $0=eyes.eyeBalls.offset();this.eyesTop=$0.top;this.eyesLeft=$0.left;$0=eyes.pupil1.position();this.leftPupilTop=$0.top;this.leftPupilLeft=$0.left;$0=eyes.pupil2.position();this.rightPupilTop=$0.top;this.rightPupilLeft=$0.left-34;this.followable=eyes.isFollowable;return this;},compare:function(p){return this.leftPupilLeft===p.leftPupilLeft&&this.leftPupilTop===p.leftPupilTop&&this.rightPupilLeft===p.rightPupilLeft&&this.rightPupilTop===p.rightPupilTop&&this.eyesLeft===p.eyesLeft&&this.eyesTop===p.eyesTop&&this.x===p.x&&this.y===p.y;}}
Eyes=function(){this.$3_0=new EyesPoint(0,0);this.$3_1=[];this.$3_9=new EyesPoint(0,0);this.$3_A=new EyesPoint(0,0);Eyes.initializeBase(this);this.element=$("<div style='position:absolute;top:0px;left:0px;width:69px;height:34px;display:none'/>");this.eyeBalls=$("<div style='position:absolute;top:0px;left:0px;width:69px;height:34px;'/>").appendTo(this.element);this.pupil1=$("<div style='position:absolute;top:13px;left:13px;width:12px;height:13px;'/>").appendTo(this.eyeBalls);this.pupil2=$("<div style='position:absolute;top:13px;left:26px;width:12px;height:13px;'/>").appendTo(this.eyeBalls);this.eyeBalls.append($("<img src='images/Eyes/eye2.gif' width='69' height='34'/>"));this.pupil1.append($("<img src='images/Eyes/pupils.gif' width='13' height='13'/>"));this.pupil2.append($("<img src='images/Eyes/pupils.gif' width='13' height='13'/>"));this.fadeIn=900;this.fadeOut=500;}
Eyes.prototype={eyeBalls:null,pupil1:null,pupil2:null,$3_2:0,$3_3:0,$3_4:0,$3_5:0,$3_6:false,$3_7:0,$3_8:0,moveTo:function(x,y){new Await().addDx(ss.Delegate.create(this,function(){
this.unfollowMouse();this.mouseY=this.$3_0.y=y;this.mouseX=this.$3_0.x=x;this.startActing();})).addAw(ss.Delegate.create(this,this.waitTrackingDoneAw)).addFn(ss.Delegate.create(this,this.flirt)).commit();return this;},moveToElement:function(el){return this.moveTo(el.offset().left+(el.width()/2),el.offset().top+10);},hide:function(){this.acting=false;window.setTimeout(ss.Delegate.create(this,function(){
if(!this.acting){this.unfollowMouse();this.moveTo(parseInt(Math.random()*window.innerWidth),parseInt(Math.random()*window.innerHeight));this.element.fadeOut(this.fadeOut);}}),200);return this;},flirt:function(){if(this.$3_6){this.stare(350);}},flirting:function(ic){this.$3_6=ic;return this;},stare:function(ms){new Await().addFn(ss.Delegate.create(this,this.$3_C)).addDx(ss.Delegate.create(this,function(){
this.$3_B(this.pupil1,13,13,200);this.$3_B(this.pupil2,9,13,200);})).addAw(ss.Delegate.create(this,this.waitTrackingDoneAw)).sleep(ms).addFn(ss.Delegate.create(this,this.$3_D),145).commit();},$3_B:function($p0,$p1,$p2,$p3){this.isFollowable=false;this.trackingDone=false;if($p0===this.pupil2){$p1+=34;}$p0.animate({top:$p2+'px',left:$p1+'px'},$p3,'swing',ss.Delegate.create(this,function(){
this.trackingDone=true;}));},$3_C:function(){var $0=new EyesPoint(this.$3_0.x,this.$3_0.y).collect(this);this.$3_1.add($0);},$3_D:function($p0){if(this.$3_1.length>0){var $0=this.$3_1[this.$3_1.length-1];this.$3_1.removeAt(this.$3_1.length-1);if(this.followDelegate==null){this.$3_B(this.pupil1,$0.leftPupilLeft,$0.leftPupilTop,$p0);this.$3_B(this.pupil2,$0.rightPupilLeft,$0.rightPupilTop,$p0);}this.isFollowable=$0.followable;}},follow:function(){window.clearTimeout(this.followTmr);this.$3_8+=(this.mouseY-this.$3_8)*0.12-2;this.$3_7+=(this.mouseX-this.$3_7)*0.12;this.$3_A.collect(this);this.$3_E();this.$3_9.collect(this);this.trackingDone=this.$3_A.compare(this.$3_9);this.followTmr=window.setTimeout(ss.Delegate.create(this,this.follow),30);},$3_E:function(){var $0=0;var $1=window.innerHeight;var $2=window.innerWidth;var $3=Math.floor(this.$3_8-34);if($3<=0){$3=0;}if($3>=$1-34){$3=$1-34;}var $4=Math.floor(this.$3_7-34);if($4<=0){$4=0;}if($4>=$2-69){$4=$2-69;}var $5=parseInt(($3+$0));var $6=parseInt($4);this.eyeBalls.css('top',$5+'px');this.eyeBalls.css('left',$6+'px');if(!this.isFollowable){return;}var $7=parseInt($5)+17;var $8=parseInt($6)+17;var $9=parseInt($5)+17;var $A=parseInt($6)+52;var $B=this.mouseY+$0-$7;var $C=this.mouseX-$8;this.$3_4=Math.sqrt($B*$B+$C*$C);var $D=this.mouseY+$0-$9;var $E=this.mouseX-$A;this.$3_5=Math.sqrt($D*$D+$E*$E);var $F=this.mouseY+$0-$7;var $10=this.mouseX-$8;this.$3_2=Math.atan2($F,$10)*180/Math.PI;var $11=this.mouseY+$0-$9;var $12=this.mouseX-$A;this.$3_3=Math.atan2($11,$12)*180/Math.PI;var $13=this.eyeBalls.offset();var $14=((this.$3_4<17)?($7-6+this.$3_4/1.7*Math.sin(this.$3_2*Math.PI/180)):($7-6+10*Math.sin(this.$3_2*Math.PI/180)));var $15=((this.$3_4<17)?($8-6+this.$3_4/1.7*Math.cos(this.$3_2*Math.PI/180)):($8-6+10*Math.cos(this.$3_2*Math.PI/180)));var $16=((this.$3_5<17)?($9-6+this.$3_5/1.7*Math.sin(this.$3_3*Math.PI/180)):($9-6+10*Math.sin(this.$3_3*Math.PI/180)));var $17=((this.$3_5<17)?($A-6+this.$3_5/1.7*Math.cos(this.$3_3*Math.PI/180)):($A-6+10*Math.cos(this.$3_3*Math.PI/180)));this.pupil1.css('top',$14-$13.top+'px');this.pupil1.css('left',$15-$13.left+'px');this.pupil2.css('top',$16-$13.top+'px');this.pupil2.css('left',$17-$13.left+'px');}}
EyesPoint.registerClass('EyesPoint');Eyes.registerClass('Eyes',Actor);})();// This script was generated using Script# v0.7.4.0


Type.registerNamespace('Yoshi.Classes');IDataShort=function(){};IDataShort.registerInterface('IDataShort');IDataStore=function(){};IDataStore.registerInterface('IDataStore');IPage=function(){};IPage.registerInterface('IPage');IData=function(){};IData.registerInterface('IData');Yoshi.Classes.PkgBase=function(){this.my=Master.page.get_data().get_user();this.$1_3={};Yoshi.Classes.PkgBase.initializeBase(this);this.$1_0=false;this.$1_3[Master.page.get_data().get_user().id]=Master.page.get_data().get_user();this.$1_3[Yoshi.Classes.PkgBase.natalie().id]=Yoshi.Classes.PkgBase.natalie();this.$1_3[Yoshi.Classes.PkgBase.meg().id]=Yoshi.Classes.PkgBase.meg();}
Yoshi.Classes.PkgBase.get_newId=function(){return 'Id'+Yoshi.Classes.PkgBase.$1_2+'n'+(++Yoshi.Classes.PkgBase.$1_1);}
Yoshi.Classes.PkgBase.natalie=function(){var $0=new YoshiUser();$0.name='Natalie Kinsey';$0.id='NatalieKinsey';$0.email='orangegroveatdawn@gmail.com';$0.bio="I woke up this morning feeling whole heartedly excited to play with this new Yes Play! site.  I love feeling the ease and  flow opening with this portal of delicious communication and play!  I love how in the zone this is for my desire to collaborate on the Yes, PLay, Love  dating site and be able share our 'work' easily with others.";$0.photo='images/Photos/Natalie.JPG';return $0;}
Yoshi.Classes.PkgBase.meg=function(){var $0=new YoshiUser();$0.name='Meg Ryan';$0.id='MegRyan';$0.email='megryan@gmail.com';$0.bio="Blond-haired, blue-eyed with an effervescent personality, Meg Ryan graduated from Bethel high school, Bethel in June 1979. Moving to New York, she attended New York University where she majored in journalism. To earn extra money while working on her degree, Meg went into acting using her new name Meg Ryan. In 1981, she had her big screen debut as Candice Bergen's daughter in George Cukor's last film Rich and Famous (1981). She tried out and was cast as Betsy in the day time television soap \"As the World Turns\"";$0.photo='images/Photos/Meg-Ryan.jpg';return $0;}
Yoshi.Classes.PkgBase.prototype={$1_0:false,otherPersonId:null,setOther:function(id){this.otherPersonId=id;},getUserByIdAw:function(awp,id){new Await().addDx(ss.Delegate.create(this,function(){
awp.set_item('pkg',this.getUserById(id));})).simulateAsync().commit(awp);},getUserById:function(id){var $dict1=this.$1_3;for(var $key2 in $dict1){var $0={key:$key2,value:$dict1[$key2]};if($0.key!==id){continue;}return $0.value;}return null;},appendPkgAsync:function(pko,partitionKey,rowKey){new Await().addDl(ss.Delegate.create(this,function($p1_0){
var $1_0=JSON.stringify(pko);this.appendLcl(partitionKey,rowKey,$1_0);this.appendPkgStringAw($p1_0,partitionKey,rowKey,'pkg',$1_0);})).addDx(function($p1_0){
Inform.log('Package appended partiton={0}, row={1}, result={2}',partitionKey,rowKey,$p1_0.get_item('pkg'));}).commit();},putPkgAsync:function(pko,partitionKey,rowKey){new Await().addDl(ss.Delegate.create(this,function($p1_0){
var $1_0=JSON.stringify(pko);window.localStorage.setItem(rowKey,$1_0);this.storePkgStringAw($p1_0,partitionKey,rowKey,'pkg',$1_0);})).addDx(function($p1_0){
Inform.log('Package stored partiton={0}, row={1}, result={2}',partitionKey,rowKey,$p1_0.get_item('pkg'));}).commit();},getPkgAw:function(awp,partitionKey,rowKey,rxKey){new Await().addDx(ss.Delegate.create(this,function($p1_0){
$p1_0.set_item('svd',this.getLcl(partitionKey,rowKey));})).addDl(ss.Delegate.create(this,function($p1_0){
this.retrievePkgStringAw($p1_0,partitionKey,rowKey,rxKey);})).addDx(function($p1_0){
awp.set_item(rxKey,($p1_0.get_item(rxKey)||$p1_0.get_item('svd')));}).handle(Exceptions.blobSaveError,Await.abortAw).commit(awp);},appendLcl:function(partitionKey,rowKey,content){if(!this.$1_0){return;}var $0=window.localStorage.getItem(rowKey)||'';var $1=$0+((String.isNullOrEmpty($0))?'':',')+content;window.localStorage.setItem(rowKey,$1);},getLcl:function(partitionKey,rowKey){if(!this.$1_0){return null;}return window.localStorage.getItem(rowKey);}}
ProfileData=function(){ProfileData.initializeBase(this);this.$1_4='Profile_'+this.my.id;}
ProfileData.prototype={$1_4:null,putProfileAsync:function(){var $0=Master.page.get_data().get_user();this.appendPkgAsync($0,'db/profile',this.$1_4);},getProfileAw:function(awp){this.getPkgAw(awp,'db/profile',this.$1_4,'pkg');}}
DropMenu=function(){}
DropMenu.addDropMenu=function(el,nameList,handler){var $0=new DropMenu();if(!ss.isValue(nameList)){throw new Error(Exceptions.argumentNull);}$0.$1=nameList;var $1=$0.$1.clone();$1.reverse();var $2;var $3;var $4=$('.DropMenu',el.parent());if(!$4.length){$3=$("<div class='DropMenuWidget'/>");var $5=$("<span class='DropMenuFire'/>").appendTo($3).html('&#x25BC;').height(el.outerHeight());var $6=$("<span class='DropMenuFocus' style='display:none;color:transparent;background:transparent;position:absolute;right:10px' tabindex='999'/>").appendTo($3).html('&#x25BC;');$2=$("<ul class='DropMenu' style='display:none'/>").appendTo($3);$3.insertAfter(el);$5.click(function($p1_0){
$p1_0.preventDefault();if(!$2.is(':visible')){var $1_0=$3.outerHeight();$6.css('top',($1_0+4)+'px').show().focus();$2.css('top',$1_0+'px').show();Master.get_eyes().moveToElement($2);}});$6.focusout(function(){
new Await().addDx(function(){
$5.focus();$6.hide();$2.fadeOut(120);Master.get_eyes().followMouse();}).commit();});DropMenu.$2($5);DropMenu.$2($6);}else{$2=$4;$2.empty();}var $enum1=ss.IEnumerator.getEnumerator($1);while($enum1.moveNext()){var $7=$enum1.current;var $8=$("<li class='DropMenuItem'/>").appendTo($2).data('MenuData',$7).click(function($p1_0){
var $1_0=$($p1_0.currentTarget).data('MenuData');handler($p1_0,$1_0);});$('<span/>').appendTo($8).html($7);}return $0;}
DropMenu.$2=function($p0){var $0=$p0[0];$0.onselectstart=function() { return false; };$0.style.MozUserSelect='none';$0.style.KhtmlUserSelect='none';$0.unselectable='on';}
DropMenu.prototype={$1:null}
EmailData=function(){EmailData.initializeBase(this);this.$1_4='SentMail_'+this.my.id;this.$1_5='RcvdMail_'+this.my.id;}
EmailData.prototype={$1_4:null,$1_5:null,getAllMailAw:function(awp){new Await().addAw(ss.Delegate.create(this,this.getRcvdMailAw)).addAw(ss.Delegate.create(this,this.getSentMailAw)).addDx(function($p1_0){
var $1_0=$p1_0.get_item('sent');var $1_1=$p1_0.get_item('rcvd');awp.set_item('pkg',$1_1.concat($1_0));}).commit(awp);},sendMailAsync:function(toId,msg){var $0=new EmailItem();$0.id=Yoshi.Classes.PkgBase.get_newId();$0.fromId=this.my.id;$0.toId=toId;$0.message=msg;$0.alias=this.my.name;$0.unread=true;$0.createTime=new Date().getTime();this.appendPkgAsync($0,'db/email/sent',this.$1_4);var $1='RcvdMail_'+toId;this.appendPkgAsync($0,'db/email/rcvd',$1);},getRcvdMailAw:function(awp){new Await().addAw(ss.Delegate.create(this,this.getPkgAw),'db/email/rcvd',this.$1_5,'rcvd').addDl(ss.Delegate.create(this,function($p1_0){
var $1_0=$p1_0.get_item('rcvd');if(SiteTheme.testing&&!ss.isValue($1_0)){new Await().addFn(ss.Delegate.create(this,this.$1_A)).sleep(2000).addDl(ss.Delegate.create(this,function($p2_0){
this.getPkgAw($p2_0,'db/email/rcvd',this.$1_5,'rcvd');})).addDx(function($p2_0){
awp.set_item('rcvd',($p2_0.get_item('rcvd')!=null)?JSON.parse('['+$p2_0.get_item('rcvd')+']'):null);}).commit(awp);$p1_0.done();return;}awp.set_item('rcvd',($1_0!=null)?JSON.parse('['+$1_0+']'):null);$p1_0.done();awp.done();})).commit();},getSentMailAw:function(awp){new Await().addAw(ss.Delegate.create(this,this.getPkgAw),'db/email/sent',this.$1_4,'sent').addDx(function($p1_0){
var $1_0=$p1_0.get_item('sent');awp.set_item('sent',($1_0!=null)?JSON.parse('['+$1_0+']'):null);}).commit(awp);},$1_A:function(){var $enum1=ss.IEnumerator.getEnumerator(this.$1_C());while($enum1.moveNext()){var $0=$enum1.current;this.appendPkgAsync($0,'db/email/sent',this.$1_4);}var $enum2=ss.IEnumerator.getEnumerator(this.$1_B());while($enum2.moveNext()){var $1=$enum2.current;this.appendPkgAsync($1,'db/email/rcvd',this.$1_5);}},$1_B:function(){var $0=this.my;var $1=Yoshi.Classes.PkgBase.natalie();var $2=Yoshi.Classes.PkgBase.meg();var $3=[];$3.add({alias:'Meg Ryan',fromId:$2.id,toId:$0.id,email:$2.email,subject:'Are you free tonight?',message:'Are you free for dinner at Ruth Chriss in Boston?',createTime:1000,unread:true});$3.add({alias:'Natalie Kinsey',fromId:$1.id,toId:$0.id,email:$1.email,subject:'Over the clover',message:'Over the clover is where you will find the end of the rainbow and the key to my heart.<br>Love<br>Natalie',createTime:2000});$3.add({alias:'Natalie Kinsey',fromId:$1.id,toId:$0.id,email:$1.email,subject:'Hey sug',message:'When you gonna finish that iPhone bubbly emailer?',createTime:4000,unread:true});return $3;},$1_C:function(){var $0=this.my;var $1=Yoshi.Classes.PkgBase.natalie();var $2=[];$2.add({alias:'Nathan Bawden',fromId:$0.id,toId:$1.id,email:$0.email,subject:'About last night ...',message:'I really loved the way you suggested we run around the house between shows. That was exilerating!!<br>Love<br>Nathan',createTime:3000});return $2;}}
RecordStore=function(){}
RecordStore.prototype={getRecord:function(db,key,name,aw){Inform.logFn(arguments);if(ss.isNullOrUndefined(db)){throw new Error(Exceptions.argumentNull);}var $0=db[key];if(ss.isNullOrUndefined($0)){throw new Error(Exceptions.recordNotExists);}if(ss.isNullOrUndefined(aw)){throw new Error(Exceptions.missingAwaitDoneEr);}Inform.trace('RecordStore.GetRecord - EOM');aw.doneWith('record',$0[name.toLowerCase()]);},putRecord:function(db,key,name,record){Inform.logFn(arguments);if(ss.isNullOrUndefined(db)){throw new Error(Exceptions.argumentNull);}var $0=db[key];if(ss.isValue($0)){$0[name.toLowerCase()]=record;}},renameRecord:function(db,key,oldName,newName){oldName=oldName.toLowerCase();newName=newName.toLowerCase();Inform.logFn(arguments);if(ss.isNullOrUndefined(db)){throw new Error(Exceptions.argumentNull);}var $0=db[key];if(ss.isValue($0)){if((typeof($0['get_'+oldName])==='function')){if((typeof($0['get_'+newName])==='function')){throw new Error(Exceptions.newRecordExists);}var $1=$0[oldName];$0[newName]=$1;delete $0[oldName];}else{throw new Error(Exceptions.recordNotExists);}}}}
MagneticData=function(data){this.$0=data;}
MagneticData.prototype={$0:null,$1:null,$2:true,get_dataRecord:function(){return this.$1;},get_recordName:function(){return (ss.isValue(this.$1))?this.$1.name:null;},renameRecord:function(oldName,newName){if(!DomElement.isValidNames(oldName,newName)){throw new Error(Exceptions.invalidName);}this.get_data().renameRecord(this.get_data().get_user(),'maglists',oldName,newName);},get_data:function(){return this.$0;},set_data:function(value){this.$0=value;return value;},get_saved:function(){this.$2=Nsb.Storage.compareObjects(this.$3(),this.$1);if(!this.$2&&this.$1!=null){this.$1.modified_time=new Date().getTime();}return this.$2;},set_saved:function(value){this.$2=value;return value;},loadRecordAw:function(awp,name){new Await().addDl(ss.Delegate.create(this,function($p1_0){
Inform.log('MagneticData.LoadRecordAw.GetRecord({0})',name);this.get_data().getRecord(this.get_data().get_user(),'maglists',name,$p1_0);})).deferred(ss.Delegate.create(this,function($p1_0){
this.$1=$p1_0.get_item('record');Inform.trace('MagneticData.LoadRecordAw.Deferred(record.name={0})',this.$1.name);awp.done();})).commit();},saveRecord:function(){var $0=this.$3();if(ss.isValue($0)){if(!ss.isValue(this.get_data().get_user().maglists)){this.get_data().get_user().maglists={};}this.$1=$0;this.get_data().putRecord(this.get_data().get_user(),'maglists',$0.name,$0);this.get_data().saveData(null);this.updatePage();}},updatePage:function(){var $0=new PageUpdate();$0.saved=this.get_saved();Master.page.updatePage($0);},$3:function(){var $0=$('.MagName');if($0.length>0){var $1=$0.val().trim();if(!String.isNullOrEmpty($1)){var $2=new MagList($1,$('#MagList textarea'));var $3=new Date().getTime();$2.modified_time=((this.$1!=null)?this.$1.modified_time:0||$3);$2.create_time=((this.$1!=null)?this.$1.create_time:0||$3);return $2;}}return null;},emptyRecord:function(){this.$1=null;},deleteList:function(name){Inform.trace('MagneticData.DeleteList()');name=name.toLowerCase();if(Object.keyExists(this.get_data().get_user().maglists,name)){delete this.get_data().get_user().maglists[name];this.set_saved(false);this.get_data().saveData(null);}}}
PageData=function(data){PageData.initializeBase(this);this.$2_0=data;}
PageData.prototype={$2_0:null,get_data:function(){return this.$2_0;},set_data:function(value){this.$2_0=value;return value;}}
Master=function(){}
Master.$2=function(){$(function(){
var $1_0=(Object.keyExists(Request.data,'page'))?Request.data['page']:Master.$0;switch($1_0){default:if(Type.isClass(Type.getType('Yoshi.Pages.'+$1_0))){Master.page=eval('new Yoshi.Pages.'+$1_0+"(jQuery('body'))");}else{throw new Error(Exceptions.invalidPageExceptionString);}break;}});return Master.page;}
Master.get_eyes=function(){if(Master.$1==null){Master.$1=new Eyes().flirting(true);Master.$1.element.appendTo(document.body);}return Master.$1;}
YoshiPage=function(){YoshiPage.initializeBase(this,[new FbDataStore()]);this.set_title('Yoshi Page');}
YoshiPage.prototype={container:null,$2_1:null,_topBar:null,pageCluster:null,pageBottom:null,get_title:function(){return document.title;},set_title:function(value){document.title=value;return value;},focusEvent:function(e){this.$2_1=(ss.isValue(e))?$(e.target):null;},isFocused:function(el){return this.$2_1!=null&&el[0]===this.$2_1[0];},basicBuildAw:function(awp,pageTitle){var $0=$("<div id='PageCenter'/>").appendTo(this.container);this.element=$("<div id='PageContent'/>").appendTo($0);this.set_title(pageTitle);new Await().addFn(ss.Delegate.create(this,this.createTopBar)).addFn(ss.Delegate.create(this,this.basicPage)).addAw(ss.Delegate.create(this.get_data(),this.get_data().authenticateAw)).addAw(ss.Delegate.create(this.get_data(),this.get_data().loadDataAw)).addFn(ss.Delegate.create(this,this.showUser)).addFn(ss.Delegate.create(this,this.basicCluster)).addFn(ss.Delegate.create(this,this.basicFooter)).addFn(ss.Delegate.create(this,this.refresh)).commit(awp);},basicPage:function(){var $0=$("<h1 id='Topic'/>").html(SiteTheme.siteTitle).appendTo(this.element);var $1=new Actor().fromHtml("<img id='TopicImage'/>");$1.element.appendTo($0).attr('src',MagneticListPageTheme.logoImage).click(function(){
window.location.reload(true);}).mouseenter(function(){
$1.shake();});},basicCluster:function(){this.pageCluster=$("<div class='PageCluster'/>").appendTo(this.element);},basicFooter:function(){this.pageBottom=$("<div class='PageBottom'/>").appendTo(this.element).html('F o o t e r');},createTopBar:function(){this._topBar=new TopBar(this.element);},showUser:function(){this._topBar.showUser();}}
YoshiUser=function(){}
YoshiUser.nameList=function(u){var $0=[];var $dict1=u.maglists;for(var $key2 in $dict1){var $1={key:$key2,value:$dict1[$key2]};$0.add($1.value.name);}return $0;}
YoshiUser.prototype={bio:null,birthday:null,email:null,first_name:null,gender:null,id:null,last_name:null,link:null,photo:null,locale:null,name:null,timezone:0,updated_time:null,verified:false,maglists:null}
YoshiAuth=function(){}
YoshiAuth.prototype={access_token:null,expires:0}
YoshiData=function(){}
YoshiData.prototype={user:null,auth:null}
MagList=function(listName,els){this.items=[];this.name=listName;var $0=this;if(ss.isValue(els)){els.each(function(){
var $1_0=$(this).val().trim();if(!String.isNullOrEmpty($1_0)){$0.items.add($1_0);}});}}
MagList.prototype={name:null,items:null,create_time:0,modified_time:0}
PageUpdate=function(){}
PageUpdate.prototype={saved:false}
EmailItem=function(){}
EmailItem.prototype={id:null,alias:null,email:null,subject:null,message:null,fromId:null,toId:null,createTime:0,modifyTime:0,unread:false}
Conversation=function(){}
Conversation.collectThread=function(items,id1,id2){var $0=new Conversation();$0.thread=[];var $enum1=ss.IEnumerator.getEnumerator(items);while($enum1.moveNext()){var $1=$enum1.current;if(($1.fromId===id1&&$1.toId===id2)||($1.fromId===id2&&$1.toId===id1)){$0.thread.add($1);}}$0.thread.sort(Conversation.dateSort);return $0;}
Conversation.dateSort=function(x,y){return (x.createTime>=y.createTime)?1:-1;}
Conversation.prototype={fromId:null,toId:null,thread:null}
Type.registerNamespace('Yoshi');Type.registerNamespace('Yoshi.Clusters');ProfileCluster=function(cluster){ProfileCluster.initializeBase(this,[cluster]);this.$4_1=this;this.ClassName='ProfileCluster'+(++ProfileCluster.$4_3);this.$4_4=this.ClassName+'_Element';}
ProfileCluster.prototype={$4_4:null,$4_5:null,$4_6:null,$4_7:null,$4_8:null,$4_9:null,$4_A:null,$4_B:0,build:function(active){this.element=$("<div class='ProfileCluster'/>").addClass(this.$4_4);this.initialize(active);this.$4_5=this.input('Alias',this.element).subHtml('span','Play Alias');this.$4_7=this.input('Email',this.element).subHtml('span','Email (hidden to others)');this.$4_6=this.input('Birthdate',this.element).subHtml('span','Birth date m/d/y');this.$4_9=this.selectBox('Physique',this.element).subHtml('span','Physical appearance').subOptions('select',{patite:'Patite',slim:'Slim',atheletic:'Athletic',average:'Average',curvy:'Curvy',handfull:'A hand full'});this.$4_A=this.checkbox('Smoke',this.element).subHtml('span','Smoker?').subAttr('input','checked',null);new Await().addAw(ss.Delegate.create(ProfileBase.data,ProfileBase.data.getProfileAw)).addDx(ss.Delegate.create(this,function(){
this.$4_B=window.setInterval(ss.Delegate.create(this,function(){
this.$4_C();}),7000);})).commit();return this;},fill:function(item){throw Exceptions.get_notImplementedException();},destroy:function(){if(!!this.$4_B){window.clearInterval(this.$4_B);}this.$4_B=0;},$4_C:function(){Inform.trace('{0}.MonitorLoop',Type.getInstanceType(this).get_name());}}
EmailBase=function(cluster){EmailBase.initializeBase(this);if(EmailBase.data==null){EmailBase.data=new EmailData();}this.$4_2=cluster;}
EmailBase.prototype={$4_0:false,$4_1:null,$4_2:null,$4_3:null,$4_4:null,initialize:function(active){this.$4_0=active;this.element.empty();},focusInput:function(){return this;},baseRebuild:function(active){new Await().addAw(ss.Delegate.create(this,this.fadeOutAw),SiteTheme.fadeOut).addDx(ss.Delegate.create(this,function(){
this.build(active);})).addAw(ss.Delegate.create(this,this.fadeInAw),SiteTheme.fadeIn).commit();},scrollInActiveAsync:function(){if(this.$4_0){new Await().addAw(ss.Delegate.create(this,this.scrollInViewAw),this.element).commit();}},$4_5:function($p0){this.$4_3=$p0.$4_3;this.$4_4=$p0.$4_4;this.$4_1=$p0.$4_1;return this;},$4_6:function($p0){this.$4_3.$4_5($p0);this.$4_4.$4_5($p0);this.$4_1.$4_5($p0);return this;}}
EmailBubbles=function(cluster){EmailBubbles.initializeBase(this,[cluster]);}
EmailBubbles.prototype={$4_7:null,$4_8:null,build:function(active){this.initialize(active);this.element.empty();return this;},appendMessage:function(active){this.$4_7=new EmailMessage(this.$4_2).fromHtml('<div/>');this.$4_7.$4_5(this.$4_2).build(active).element.appendTo(this.element).fadeIn(SiteTheme.fadeIn);return this.$4_7;},appendReply:function(active){this.$4_8=new EmailReply(this.$4_2).fromHtml('<div/>');this.$4_8.$4_5(this.$4_2).build(active).element.appendTo(this.element).fadeIn(SiteTheme.fadeIn);return this.$4_8;},fill:function(item){throw Exceptions.get_notImplementedException();},rebuild:function(active){this.baseRebuild(active);return this;},rebuildMessage:function(active){if(this.$4_7!=null&&this.$4_7.$4_0!==active){new Await().addAw(ss.Delegate.create(this.$4_7,this.$4_7.rebuildAw),active).commit();}return this;},clear:function(){this.element.empty();this.$4_7=null;this.$4_8=null;},scrollActiveToView:function(){if(this.$4_8!=null&&this.$4_8.$4_0){this.$4_8.scrollInActiveAsync();}else if(this.$4_7!=null&&this.$4_7.$4_0){this.$4_7.scrollInActiveAsync();}},showBubbles:function(fromId){new Await().addFn(ss.Delegate.create(this,this.clear)).addAw(ss.Delegate.create(EmailBase.data,EmailBase.data.getAllMailAw)).addDx(ss.Delegate.create(this,function($p1_0){
var $1_0=Master.page.get_data().get_user().id;var $1_1=Conversation.collectThread($p1_0.get_item('pkg'),$1_0,fromId);var $1_2=0;var $1_3=false;var $1_4=null;var $enum1=ss.IEnumerator.getEnumerator($1_1.thread);while($enum1.moveNext()){var $1_5=$enum1.current;var $1_6=++$1_2===$1_1.thread.length;if($1_5.toId===$1_0&&$1_5.fromId===fromId){$1_4=this.appendMessage($1_6).fill($1_5.message).element;if($1_6){$1_3=true;}}else{this.appendReply(false).fill($1_5.message);}}if(!$1_3){$1_4=this.appendReply(true).fill('').focusInput().element;}if(this.$4_7!=null){this.$4_7.scrollInActiveAsync();}if(this.$4_8!=null){this.$4_8.scrollInActiveAsync();}})).commit();}}
EmailCluster=function(cluster){EmailCluster.initializeBase(this,[cluster]);this.$4_2=this;this.ClassName='EmailBubble'+(++EmailCluster.$4_A);this.$4_9=this.ClassName+'_Element';}
EmailCluster.prototype={$4_8:0,$4_9:null,build:function(active){this.element=$("<div class='EmailBubble'/>").addClass(this.$4_9);this.initialize(active);this.$4_3=new EmailInbox(this).fromHtml("<div class='Inbox'/>");this.$4_4=new Yoshi.Clusters.EmailProfile(this).fromHtml("<div class='Profile'/>");this.$4_1=new EmailBubbles(this).fromHtml("<div class='Bubbles'/>");this.$4_6(this);this.$4_3.build(true).element.appendTo(this.element);this.$4_4.build(true).element.appendTo(this.element);this.$4_1.build(true).element.appendTo(this.element);new Await().addAw(ss.Delegate.create(EmailBase.data,EmailBase.data.getRcvdMailAw)).addDx(ss.Delegate.create(this,function($p1_0){
this.$4_3.updateList($p1_0.get_item('rcvd'));this.$4_8=window.setInterval(ss.Delegate.create(this,function(){
this.$4_B();}),7000);})).commit();return this;},fill:function(item){throw Exceptions.get_notImplementedException();},destroy:function(){if(!!this.$4_8){window.clearInterval(this.$4_8);}this.$4_8=0;},$4_B:function(){Inform.trace('{0}.MonitorLoop',Type.getInstanceType(this).get_name());}}
EmailInbox=function(cluster){EmailInbox.initializeBase(this,[cluster]);}
EmailInbox.prototype={$4_7:null,build:function(active){this.initialize(active);this.element.addClass('Section');$("<div class='Header'/>").appendTo(this.element).html(EmailTheme.inboxTitle);this.$4_7=$("<ul class='InboxList'/>").appendTo(this.element);return this;},fill:function(item){throw Exceptions.get_notImplementedException();},updateList:function(list){var $0=EmailBase.data.my.id;this.$4_7.empty();if(list!=null){var $enum1=ss.IEnumerator.getEnumerator(list);while($enum1.moveNext()){var $1=$enum1.current;if($1.toId===$0){this.$4_8($1).appendTo(this.$4_7);}}}},$4_8:function($p0){var $0=$('<li/>');$("<span class='Alias'/>").appendTo($0).html($p0.alias).attr('title',$p0.alias);var $1=$p0.message.substr(0,50);$("<span class='Message'/>").appendTo($0).html($1);if($p0.unread){$0.addClass('Unread');}$0.click(ss.Delegate.create(this,function(){
$('li',this.element).removeClass('Selected');$0.addClass('Selected');if(this.$4_4!=null&&this.$4_1!=null){new Await().addFn(ss.Delegate.create(this.$4_4,this.$4_4.fillFromIdAsync),$p0.fromId).addAw(ss.Delegate.create(this,this.scrollToAw),this.$4_4.element).addFn(ss.Delegate.create(EmailBase.data,EmailBase.data.setOther),$p0.fromId).addFn(ss.Delegate.create(this.$4_1,this.$4_1.showBubbles),$p0.fromId).commit();}}));return $0;}}
EmailMessage=function(cluster){EmailMessage.initializeBase(this,[cluster]);}
EmailMessage.prototype={$4_7:null,$4_8:null,build:function(active){this.initialize(active);this.element.addClass('Section LeftSide Message').hide();if(active){this.$4_8=$("<div class='Header'/>").appendTo(this.element).html(EmailTheme.messageTitle);$("<span class='ActionBtn ReplyBtn'/>").appendTo(this.$4_8).html(EmailTheme.replyButton).click(ss.Delegate.create(this,function(){
new Await().addAw(ss.Delegate.create(this,this.rebuildAw),false).addDl(ss.Delegate.create(this,function($p2_0){
if(this.$4_1!=null){var $2_0=this.$4_1.appendReply(true).fill('').focusInput().element;this.scrollInViewAw($p2_0,$2_0);}else{$p2_0.done();}})).commit();}));}this.$4_7=$("<p class='Body MessageBody'/>").appendTo(this.element);return this;},rebuildAw:function(awp,active){var $0=this.$4_7.html();new Await().addAw(ss.Delegate.create(this,this.fadeOutAw),SiteTheme.fadeOut).addDx(ss.Delegate.create(this,function(){
this.build(active).fill($0);})).addAw(ss.Delegate.create(this,this.fadeInAw),SiteTheme.fadeIn).commit(awp);},fill:function(msg){this.$4_7.html(msg);return this;}}
EmailReply=function(cluster){EmailReply.initializeBase(this,[cluster]);}
EmailReply.$4_A=function(){$('.EmailBubble .Reply textarea').live('keypress.emailreply',function($p1_0){
if($p1_0.which===13&&$p1_0.shiftKey){$('.EmailBubble .Reply .SendBtn').click();}});return true;}
EmailReply.prototype={$4_7:null,$4_8:null,build:function(active){this.initialize(active);this.element.hide().empty().addClass('Section RightSide Reply').removeClass('RightSideInput');if(active){this.element.addClass('RightSideInput');this.$4_7=$("<div class='Header'/>").appendTo(this.element).html(EmailTheme.replyTitle);this.$4_8=$("<textarea class='Body ReplyBody'/>").appendTo(this.element);$("<span class='ActionBtn SendBtn'/>").appendTo(this.$4_7).html(EmailTheme.sendButton).click(ss.Delegate.create(this,function(){
if(String.isNullOrEmpty(this.$4_8.val().trim())){Alert.ask('Please fill in a reply');}else{if(this.$4_1!=null){this.$4_1.rebuildMessage(false).appendReply(true).focusInput();}this.rebuild(false);EmailBase.data.sendMailAsync(EmailBase.data.otherPersonId,this.$4_8.val());}}));}else{this.$4_8=$("<p class='Body ReplyBody'/>").appendTo(this.element);}return this;},rebuild:function(active){var $0=(this.$4_0)?this.$4_8.val():this.$4_8.html();new Await().addAw(ss.Delegate.create(this,this.fadeOutAw),SiteTheme.fadeOut).addDx(ss.Delegate.create(this,function(){
this.build(active).fill($0);})).addAw(ss.Delegate.create(this,this.fadeInAw),SiteTheme.fadeIn).commit();return this;},fill:function(msg){this.$4_8.html(msg).val(msg);return this;},focusInput:function(){new Await().addAw(ss.Delegate.create(this,this.slideDownAw),SiteTheme.slideDown).addFn(ss.Delegate.create(this,this.focus),this.$4_8).addAw(ss.Delegate.create(this,this.scrollInViewAw),this.element).commit();return this;}}
Yoshi.Clusters.EmailProfile=function(cluster){Yoshi.Clusters.EmailProfile.initializeBase(this,[cluster]);}
Yoshi.Clusters.EmailProfile.prototype={$4_7:null,$4_8:null,$4_9:null,$4_A:null,$4_B:null,$4_C:null,build:function(active){this.initialize(active);this.element.addClass('Section');this.$4_7=$("<div class='Jar'/>").appendTo(this.element).hide();this.$4_8=$("<div class='PhotoCell'/>").appendTo(this.$4_7);this.$4_9=$('<img/>').appendTo(this.$4_8).css({width:'100%'});this.$4_A=$("<div class='InfoCell'/>").appendTo(this.$4_7);this.$4_B=$("<p class='Name Info'/>").appendTo(this.$4_A);this.$4_C=$("<p class='Bio Info'/>").appendTo(this.$4_A);return this;},fillFromIdAsync:function(userId){this.$4_8.hide();new Await().addFn(ss.Delegate.create(this,this.hide)).addAw(ss.Delegate.create(EmailBase.data,EmailBase.data.getUserByIdAw),userId).addDx(ss.Delegate.create(this,function($p1_0){
var $1_0=$p1_0.get_item('pkg');if(ss.isValue($1_0)){this.fill($1_0);}})).addAw(ss.Delegate.create(this,this.slideDownAw),SiteTheme.slideDown).addDx(ss.Delegate.create(this,function(){
this.$4_8.fadeIn(250);})).addFn(ss.Delegate.create(this.$4_1,this.$4_1.scrollActiveToView)).commit();},fill:function(user){var $0=user;this.$4_9.attr('src',$0.photo);this.$4_B.html($0.name);this.$4_C.html($0.bio);return this;}}
ProfileBase=function(cluster){ProfileBase.initializeBase(this);if(ProfileBase.data==null){ProfileBase.data=new ProfileData();}this.$4_1=cluster;}
ProfileBase.prototype={$4_0:false,$4_1:null,initialize:function(active){this.$4_0=active;this.element.empty();},focusInput:function(){return this;}}
TopBar=function(element){TopBar.initializeBase(this);this.element=element;this.$2_1=Master.page;this.$2_2();}
TopBar.prototype={$2_0:null,$2_1:null,$2_2:function(){this.$2_0=$("<div id='TopBar'/>").prependTo(this.element);DomElement.newLink(TopBarTheme.homeBtnText,'index.html').appendTo(this.$2_0).addClass('BarLink');DomElement.newLink(TopBarTheme.magneticListBtnText,'yoshi.html?page=MagneticListPage').appendTo(this.$2_0).addClass('BarLink');DomElement.newLink(TopBarTheme.emailBtnText,'yoshi.html?page=EmailPage').appendTo(this.$2_0).addClass('BarLink');$("<span id='SavedIndicator'/>").appendTo(this.$2_0);},showUser:function(){new Await().addDx(ss.Delegate.create(this,function(){
$("<div class='CornerUser'/>").appendTo(this.$2_0).append($("<span class='UserName'>"+this.$2_1.get_data().get_user().name+'</span>')).append(this.$2_1.get_data().get_photoTag().addClass('UserPhoto')).append($("<span class='ProfileVis'>"+TopBarTheme.profileVis+'</span>')).click(function(){
window.location.href='yoshi.html?page=ProfilePage';});})).commit();},updatePage:function(pu){var $0=$('#SavedIndicator');if($0.length>0){$0.html((pu.saved)?TopBarTheme.saved:TopBarTheme.unsaved);}}}
MagBubble=function(awp){this.$2_5=MagneticListTheme.bubbleTopic;MagBubble.initializeBase(this);this.ClassName='MagBubble'+(++MagBubble.$2_A);this.$2_1=awp;this.$2_2=new MagneticData(Master.page.get_data());this.$2_C();}
MagBubble.prototype={$2_1:null,$2_2:null,$2_3:0,$2_4:null,$2_6:null,$2_7:null,$2_8:0,$2_9:null,get_listTitle:function(){return this.$2_5;},set_listTitle:function(value){this.$2_5=value;return value;},get_$2_B:function(){if(this.$2_3>1){return true;}var $0=$('.MagItem');return $0.length>0&&!String.isNullOrEmpty($0.val().trim());},$2_C:function(){this.$2_9=this.ClassName+'_Element';this.element=$('<div/>').addClass(this.$2_9);$(String.format('.{0} .MagName, .{0} .MagItem',this.$2_9)).live('keypress.maglist',ss.Delegate.create(this,function($p1_0){
this.$2_2.set_saved(false);if($p1_0.which===9||$p1_0.which===13){DomElement.cancelEvent($p1_0);if(!$($p1_0.target).is('.MagName')){this.$2_15();}this.$2_16();this.$2_14();this.$2_F();}this.$2_2.updatePage();})).live('focus.maglist',function($p1_0){
Master.page.focusEvent($p1_0);Master.get_eyes().moveToElement($($p1_0.target));}).live('blur.maglist',function(){
Master.page.focusEvent(null);Master.get_eyes().followMouse();});$(String.format('.{0} .MagName',this.$2_9)).live('blur.magname',ss.Delegate.create(this,function($p1_0){
var $1_0=$($p1_0.target);Inform.trace('Bluring {0}[{1}]',$p1_0.target.tagName,$p1_0.target.tabIndex);Master.page.focusEvent(null);Master.get_eyes().followMouse();var $1_1=DomElement.cleanName($1_0.val());var $1_2=$1_1.toLowerCase();var $1_3=DomElement.cleanName(this.$2_2.get_recordName()).toLowerCase();if(!String.isNullOrEmpty($1_2)&&$1_2!==$1_3){if(Object.keyExists(this.$2_2.get_data().get_user().maglists,$1_2)){new Await().addFn(ss.Delegate.create(this,this.$2_D),$1_1).commit();}else if(!String.isNullOrEmpty($1_2)){new Await().addDx(ss.Delegate.create(this,function(){
this.$2_4.empty();this.$2_3=0;})).addFn(ss.Delegate.create(this,this.$2_16)).addFn(ss.Delegate.create(this,this.$2_F)).addFn(ss.Delegate.create(this,this.$2_14)).commit();}}}));new Await().addFn(ss.Delegate.create(this,this.$2_E)).addDx(ss.Delegate.create(this,function(){
this.$2_8=window.setInterval(ss.Delegate.create(this,function(){
this.$2_17();}),7000);})).commit(this.$2_1);},destroy:function(){if(!!this.$2_8){window.clearInterval(this.$2_8);}this.$2_8=0;$(String.format('.{0} .MagName, .{0} .MagItem',this.$2_9)).die('keydown.maglist').die('focus.maglist').die('blur.maglist');$(String.format('.{0} .MagName',this.$2_9)).die('blur.magname');},$2_D:function($p0){new Await().addAw(ss.Delegate.create(this.$2_2,this.$2_2.loadRecordAw),$p0).addFn(ss.Delegate.create(this,this.$2_11)).addFn(ss.Delegate.create(this,this.$2_12)).addFn(ss.Delegate.create(this,this.$2_10)).addFn(ss.Delegate.create(this,this.$2_F)).addFn(ss.Delegate.create(this,this.$2_14)).addFn(ss.Delegate.create(this.$2_2,this.$2_2.updatePage)).commit();},$2_E:function(){new Await().addFn(ss.Delegate.create(this.$2_2,this.$2_2.emptyRecord)).addFn(ss.Delegate.create(this,this.$2_11)).addFn(ss.Delegate.create(this,this.$2_10)).addFn(ss.Delegate.create(this,this.$2_14)).addDx(ss.Delegate.create(this,function(){
this.$2_7.val('').focus();})).commit();},$2_F:function(){var $0=$('.MagItem',this.element).last();if(!$0.length||!String.isNullOrEmpty($0.val().trim())){this.$2_13().focus();}else{$0.focus();}},$2_10:function(){this.element.empty().append(this.$2_6);},$2_11:function(){Inform.logFn(arguments);this.$2_3=0;this.$2_4=$("<ol id='MagList'/>");this.$2_7=$("<input class='MagName' tabindex='1'/>");this.$2_6=$("<div id='MagneticList' class='MagneticList'/>").append(this.$2_7).append(this.$2_4);if(ss.isValue(this.$2_2.get_dataRecord())){Inform.trace('-- Putting existing record');this.$2_6.prepend($("<div class='MagTitle'/>").html(this.$2_5));this.$2_7.val(this.$2_2.get_recordName());}else{Inform.trace('-- Putting new record');this.$2_6.prepend($("<div class='MagTitle'/>").html('New - '+this.$2_5));}this.$2_16();},$2_12:function(){this.$2_3=0;if(ss.isNullOrUndefined(this.$2_2.get_recordName())){return;}var $enum1=ss.IEnumerator.getEnumerator(this.$2_2.get_dataRecord().items);while($enum1.moveNext()){var $0=$enum1.current;if($0.trim().length>0){var $1=this.$2_13();$1.val($0);}}},$2_13:function(){var $0=$('<li/>');var $1=$("<textarea class='MagItem'/>").appendTo($0).attr('tabindex',(this.$2_3+2).toString());$("<span class='MagItemDelete'/>").appendTo($0).html('x').click(ss.Delegate.create(this,function(){
$0.remove();this.$2_15();})).attr('title',MagneticListTheme.deleteItemTitle);this.$2_4.append($0);this.$2_3++;return $1;},$2_14:function(){if($('.MagNew',this.element).length>0){return;}if(this.get_$2_B()){$("<span class='MagDelete'/>").insertBefore(this.$2_4).html('delete').attr('title',MagneticListTheme.deleteListTitle).click(ss.Delegate.create(this,function(){
new Await().addAw(Answer.boxAw,{Message:String.format('Delete {0} for sure?',this.$2_2.get_recordName()),Title:'',OkFace:'Oh Yea!'}).addAw(Notify.requireResultAw,true).addFn(ss.Delegate.create(this.$2_2,this.$2_2.updatePage)).addFn(ss.Delegate.create(this.$2_2,this.$2_2.deleteList),this.$2_2.get_recordName()).addFn(ss.Delegate.create(this,this.$2_E)).commit();}));}$("<span class='MagNew'/>").insertBefore(this.$2_4).html('new').attr('title',MagneticListTheme.newListTitle).click(ss.Delegate.create(this,function(){
new Await().addFn(ss.Delegate.create(this,this.$2_15)).addFn(ss.Delegate.create(this.$2_2,this.$2_2.emptyRecord)).addFn(ss.Delegate.create(this,this.$2_E)).commit();}));},$2_15:function(){if(this.get_$2_B()){this.$2_2.saveRecord();}},$2_16:function(){DropMenu.addDropMenu(this.$2_7,YoshiUser.nameList(this.$2_2.get_data().get_user()),ss.Delegate.create(this,function($p1_0,$p1_1){
new Await().addFn(ss.Delegate.create(this,this.$2_15)).addFn(ss.Delegate.create(this,this.$2_D),$p1_1).commit();}));},$2_17:function(){Inform.trace('MonitorLoop');if(!Master.page.isFocused($('.MagName',this.element))){Inform.log('IsFocused');if(!this.$2_2.get_saved()){this.$2_15();}else{this.$2_2.updatePage();}}}}
Type.registerNamespace('Yoshi.Fb');FbFileData=function(){FbFileData.initializeBase(this);}
FbFileData.prototype={$B:function($p0){this.$C($p0);},$C:function($p0){var $0={};$0['password']='SuperBaby';$0['path']='db/';$0['file']='FB'+this.fbBaseUser.id+'.json';var $1={};$1.url='/yoshi/data/file.get.php';$1.data=$0;$1.dataType='jsonp';$1.type='GET';$1.success=ss.Delegate.create(this,function($p1_0,$p1_1,$p1_2){
var $1_0=this.$10($p1_0.content);if(ss.isValue($p0)){$p0($1_0);}});$1.error=function($p1_0,$p1_1,$p1_2){
Inform.error('Error saving blob to a file error='+$p1_1+' : '+$p1_2+' : '+$p1_0.responseText);};$.ajax($1);},$D:function($p0,$p1){this.$E($p0,$p1);},$E:function($p0,$p1){var $0=this.$F($p0);var $1={};$1['password']='SuperBaby';$1['createFile']='true';$1['createPath']='true';$1['path']='db/';$1['file']='FB'+this.fbBaseUser.id+'.json';$1['content']=$0;var $2={};$2.url='data/file.put.php';$2.data=$1;$2.type='POST';$2.success=function($p1_0,$p1_1,$p1_2){
try{if(!ss.isValue($p1_0)||!$p1_0.result){throw new Error(Exceptions.blobSaveError);}}catch($1_0){throw new Error(Exceptions.blobSaveError);}if(ss.isValue($p1)){$p1($p1_0);}};$2.error=function($p1_0,$p1_1,$p1_2){
Inform.error('Error saving blob to a file error='+$p1_1+' : '+$p1_2+' : '+$p1_0);};$.ajax($2);},$F:function($p0){return this.$11(JSON.stringify($p0));},$10:function($p0){if(!String.isNullOrEmpty($p0)){return JSON.parse(this.$12($p0));}return '';},$11:function($p0){return Nsb.Encoder.encode64(Nsb.Encoder.lzwEncode($p0));},$12:function($p0){return Nsb.Encoder.lzwDecode(Nsb.Encoder.decode64($p0));}}
FbDataStore=function(){FbDataStore.initializeBase(this);}
FbDataStore.prototype={$15:false,$16:null,get_user:function(){return this.$16;},set_user:function(value){this.$16=value;return value;},get_auth:function(){return this.fbBaseAuth;},get_photoUrl:function(){return String.format(FbDataStore.$14,this.fbBaseUser.id);},get_photoTag:function(){return $('<img/>').attr('src',this.get_photoUrl());},get_autoSave:function(){return this.$15;},set_autoSave:function(value){this.$15=value;return value;},authenticateAw:function(aw){if(!this.get_authenticated()){this.fbAuthenticate(aw);}else{aw.done();}},loadDataAw:function(aw){var $0=Nsb.Storage.getLocal('YoshiData');if(ss.isValue($0)){this.set_user($0.user);if(ss.isValue(this.get_user().maglists)){var $1={};var $dict1=this.get_user().maglists;for(var $key2 in $dict1){var $2={key:$key2,value:$dict1[$key2]};$1[$2.key.toLowerCase()]=$2.value;}this.get_user().maglists=$1;}}else{this.set_user(new YoshiUser());$.extend(true,this.get_user(),this.fbBaseUser);}this.$B(ss.Delegate.create(this,function($p1_0){
try{if(ss.isValue($p1_0)){var $1_0=$p1_0;if(!ss.isValue(this.get_user())){this.set_user(new YoshiUser());}if(ss.isValue($1_0.user.maglists)){var $1_1={};var $dict1=$1_0.user.maglists;for(var $key2 in $dict1){var $1_2={key:$key2,value:$dict1[$key2]};$1_1[$1_2.key.toLowerCase()]=$1_2.value;}$1_0.user.maglists=$1_1;}$.extend(true,this.get_user(),$1_0.user);}this.saveData(null);}catch($1_3){}aw.done();}));},saveData:function(aw){var $0=new YoshiData();$0.user=this.get_user();$0.auth=this.get_auth();if(!Nsb.Storage.compareLocal('YoshiData',$0)){Nsb.Storage.setLocal('YoshiData',$0);this.$D($0);}else{Inform.trace('Blob unchanged - not saved');}if(ss.isValue(aw)){aw.done();}},retrieveFriends:function(fn){if(!ss.isValue(this.get_user())){return;}this.getCache(this.get_user().id,'friends',function($p1_0){
if(ss.isValue(fn)){fn($p1_0);}Inform.log('RetrieveFriends - Friend count = {0}',($p1_0).data.length);});},retrievePhotos:function(albumName,fn){if(!ss.isValue(this.get_user())){return;}this.getCache(this.get_user().id,'albums',ss.Delegate.create(this,function($p1_0){
var $1_0=($p1_0).data;var $1_1='';if(ss.isValue($1_0)){var $enum1=ss.IEnumerator.getEnumerator($1_0);while($enum1.moveNext()){var $1_2=$enum1.current;if($1_2.name!==albumName){continue;}$1_1=$1_2.id;break;}}this.getCache($1_1,'photos',function($p2_0){
var $2_0=($p2_0).data;if(ss.isValue(fn)){fn($2_0);}});}));},get_item:function(item){return (this.fbBaseUser)[item];},set_item:function(item,value){(this.fbBaseUser)[item]=value;return value;}}
FbUser=function(){}
FbUser.prototype={bio:null,birthday:null,email:null,first_name:null,gender:null,id:null,last_name:null,link:null,locale:null,name:null,timezone:0,updated_time:null,verified:false,work:null}
FbList=function(){}
FbList.prototype={id:null,list_type:null,name:null}
FbResult=function(){}
FbResult.prototype={data:null,error:null,paging:null}
FbPaging=function(){}
FbPaging.prototype={next:null,prior:null}
FbLimitRequest=function(){}
FbLimitRequest.prototype={access_token:null,limit:0,offset:0}
FbOffsetRequest=function(){}
FbOffsetRequest.prototype={access_token:null,limit:0,offset:0}
FbObject=function(){}
FbObject.prototype={error:null}
FbObjectError=function(){}
FbObjectError.prototype={message:null,type:null}
FbAuth=function(){}
FbAuth.prototype={access_token:null,expires:0}
FbWork=function(){}
FbWork.prototype={employer:null}
FbAlbum=function(){}
FbAlbum.prototype={from:null,id:null,link:null,name:null,privacy:null,type:null}
FbPhoto=function(){}
FbPhoto.prototype={comments:null,created_time:null,from:null,height:0,icon:null,id:null,images:null,link:null,name:null,picture:null,position:0,source:null,tags:null,updated_time:null,width:0}
FbTags=function(){}
FbTags.prototype={data:null}
FbTag=function(){}
FbTag.prototype={created_time:null,id:null,name:null,x:0,y:0}
FbNote=function(){}
FbNote.prototype={created_time:null,from:null,icon:null,id:null,message:null,subject:null,updated_time:null}
FbImage=function(){}
FbImage.prototype={height:0,source:null,width:0}
FbComments=function(){}
FbComments.prototype={data:null}
FbComment=function(){}
FbComment.prototype={can_remove:false,created_time:null,from:null,id:null,message:null}
FbSendStorage=function(){}
FbSendStorage.prototype={access_token:null,id:null,jsonData:null,message:null,connection:null}
FbIdentity=function(){this.$6={};FbIdentity.initializeBase(this);}
FbIdentity.$7=function($p0){if(ss.isValue($p0)){if(ss.isValue($p0.error)){if($p0.error.type==='OAuthException'){Nsb.Storage.setLocal('EntryUrl',window.location.href);window.location.href=window.location.protocol+'//'+window.location.host+'/'+FbIdentity.$5;throw new Error('FBDone');}Inform.error($p0.error.message);throw new Error('FBError');}}}
FbIdentity.$8=function(){var $0=new FbAuth();var $1=window.location.search.substr(1);if(!String.isNullOrEmpty($1)){var $2=$1.split('&');var $enum1=ss.IEnumerator.getEnumerator($2);while($enum1.moveNext()){var $3=$enum1.current;var $4=$3.split('=');var $5=$4[0];var $6=$4[1];switch($5){case 'access_token':$0.access_token=$6;break;case 'expires':var $7=parseInt($6)*1000;$0.expires=new Date().getTime()+$7;break;}}}if(!ss.isNullOrUndefined($0.access_token)){Nsb.Storage.setLocal('FbAccessToken',$0);Inform.log('access_token={0}',$0.access_token);Inform.log('expires={0}',new Date($0.expires));var $8=Nsb.Storage.getLocal('EntryUrl');if(!String.isNullOrEmpty($8)){window.location.href=$8;throw new Error('FBDone');}}$0=Nsb.Storage.getLocal('FbAccessToken');return (ss.isNullOrUndefined($0))?new FbAuth():$0;}
FbIdentity.prototype={fbBaseAuth:null,fbBaseUser:null,setProperty:function(name,value){this[name]=value;return this;},get_authenticated:function(){return ss.isValue(this.fbBaseUser);},fbAuthenticate:function(aw){aw.trace('FbIdentity.FbAuthenticate()');this.fbBaseAuth=FbIdentity.$8();var $0={};var $1=new FbLimitRequest();$1.access_token=this.fbBaseAuth.access_token;$0.url='https://graph.facebook.com'+'/me';$0.type='GET';$0.dataType='jsonp';$0.data=$1;$0.success=ss.Delegate.create(this,function($p1_0,$p1_1,$p1_2){
FbIdentity.$7($p1_0);this.fbBaseUser=$p1_0;Inform.log(String.format('request.Success : User: {0}',this.fbBaseUser.name));aw.done();});$0.error=function(){
Inform.error('Error sending Facebook authentication request');aw.abort();};$.ajax($0);},post:function(id,values,connection,fn){var $0={};$0.url='https://graph.facebook.com'+'/'+id+((ss.isValue(connection))?'/'+connection:'')+'?access_token='+this.fbBaseAuth.access_token;$0.type='POST';$0.dataType='html';$0.data=values;$0.success=function($p1_0,$p1_1,$p1_2){
if(ss.isValue(fn)){fn($p1_0);}};$0.error=function($p1_0,$p1_1,$p1_2){
Inform.error(String.format('Error posting to Facebook graph api : {0}',$p1_1));};$.ajax($0);},deleteById:function(id,fn){var $0={};var $1={};$1['access_token']=this.fbBaseAuth.access_token;$1['method']='delete';$0.url='https://graph.facebook.com'+'/'+id;$0.type='POST';$0.dataType='json';$0.data=$1;$0.success=function($p1_0,$p1_1,$p1_2){
if(ss.isValue(fn)){fn($p1_0);}};$0.error=function($p1_0,$p1_1,$p1_2){
Inform.error(String.format('Error deleting in Facebook graph api : {0}',$p1_1));};$.ajax($0);},get:function(id,connection,fn){var $0={};var $1={};$1['access_token']=this.fbBaseAuth.access_token;$1['limit']=5000;$0.url='https://graph.facebook.com'+'/'+id+((ss.isValue(connection))?'/'+connection:'');$0.type='GET';$0.dataType='jsonp';$0.data=$1;$0.success=function($p1_0,$p1_1,$p1_2){
if(ss.isValue(fn)){fn($p1_0);}};$0.error=function($p1_0,$p1_1,$p1_2){
Inform.error(String.format('Error getting from Facebook graph api : {0}',$p1_1));};$.ajax($0);},getCache:function(id,connection,fn){var $0=id+'/'+connection;if(Object.keyExists(this.$6,$0)){if(ss.isValue(fn)){fn(this.$6[$0]);}return;}this.get(id,connection,ss.Delegate.create(this,function($p1_0){
this.$6[$0]=$p1_0;if(ss.isValue(fn)){fn($p1_0);}}));}}
Type.registerNamespace('Yoshi.Pages');Yoshi.Pages.ProfilePage=function(container){Yoshi.Pages.ProfilePage.initializeBase(this);var $0=false;Inform.passExceptions=$0;Inform.tracing=$0;Inform.logActions=$0;this.container=container;this.$2_3();}
Yoshi.Pages.ProfilePage.prototype={$2_2:null,$2_3:function(){new Await().addAw(ss.Delegate.create(this,this.basicBuildAw),UserTheme.pageTitle).commit();},refresh:function(){new Await().addDx(ss.Delegate.create(this,function(){
if(ss.isValue(this.$2_2)){this.$2_2.destroy();}})).addDx(ss.Delegate.create(this,function(){
this.$2_2=new ProfileCluster(null);})).addDx(ss.Delegate.create(this,function(){
this.$2_2.build(true);})).addDx(ss.Delegate.create(this,function(){
this.$2_2.element.appendTo(this.pageCluster);})).commit();},updatePage:function(pu){this._topBar.updatePage(pu);}}
Yoshi.Pages.EmailPage=function(container){Yoshi.Pages.EmailPage.initializeBase(this);var $0=false;Inform.passExceptions=$0;Inform.tracing=$0;Inform.logActions=$0;this.container=container;this.$2_3();}
Yoshi.Pages.EmailPage.prototype={$2_2:null,$2_3:function(){new Await().addAw(ss.Delegate.create(this,this.basicBuildAw),EmailTheme.pageTitle).commit();},refresh:function(){new Await().addDx(ss.Delegate.create(this,function(){
if(ss.isValue(this.$2_2)){this.$2_2.destroy();}})).addDx(ss.Delegate.create(this,function(){
this.$2_2=new EmailCluster(null);})).addDx(ss.Delegate.create(this,function(){
this.$2_2.build(true);})).addDx(ss.Delegate.create(this,function(){
this.$2_2.element.appendTo(this.pageCluster);})).commit();},updatePage:function(pu){this._topBar.updatePage(pu);}}
Yoshi.Pages.MagneticListPage=function(container){Yoshi.Pages.MagneticListPage.initializeBase(this);var $0=false;Inform.passExceptions=$0;Inform.tracing=$0;Inform.logActions=$0;this.container=container;this.$2_3();}
Yoshi.Pages.MagneticListPage.prototype={$2_2:null,$2_3:function(){new Await().addAw(ss.Delegate.create(this,this.basicBuildAw),MagneticListPageTheme.pageTitle).addFn(ss.Delegate.create(this,this.$2_4)).commit();},$2_4:function(){$('#TopicImage').unbind('click').live('click',function($p1_0){
if($p1_0.shiftKey){new Await().addAw(Alert.askAw,'You are the absolute best!!!').addAw(Answer.boxAw,{ClassName:'Wiggy',Message:'Wow! This is great!',Title:'Hey there super guy!',OkFace:'Oh Yea!'}).deferred(function($p2_0){
Alert.ask('Result {0}',$p2_0.get_item('alertResult'));}).commit();}else{window.location.reload(true);}});},refresh:function(){new Await().addDx(ss.Delegate.create(this,function($p1_0){
if(ss.isValue(this.$2_2)){this.$2_2.destroy();}this.$2_2=new MagBubble($p1_0);this.$2_2.element.appendTo(this.pageCluster);})).commit();},updatePage:function(pu){this._topBar.updatePage(pu);}}
Yoshi.Classes.PkgBase.registerClass('Yoshi.Classes.PkgBase',FileBlobBase);ProfileData.registerClass('ProfileData',Yoshi.Classes.PkgBase);DropMenu.registerClass('DropMenu');EmailData.registerClass('EmailData',Yoshi.Classes.PkgBase);RecordStore.registerClass('RecordStore');MagneticData.registerClass('MagneticData',null,IData);PageData.registerClass('PageData',Cluster,IDataShort);Master.registerClass('Master');YoshiPage.registerClass('YoshiPage',PageData,IPage);YoshiUser.registerClass('YoshiUser');YoshiAuth.registerClass('YoshiAuth');YoshiData.registerClass('YoshiData');MagList.registerClass('MagList');PageUpdate.registerClass('PageUpdate');EmailItem.registerClass('EmailItem');Conversation.registerClass('Conversation');ProfileBase.registerClass('ProfileBase',Nsb.Classes.Truple);ProfileCluster.registerClass('ProfileCluster',ProfileBase);EmailBase.registerClass('EmailBase',Nsb.Classes.Truple);EmailBubbles.registerClass('EmailBubbles',EmailBase);EmailCluster.registerClass('EmailCluster',EmailBase);EmailInbox.registerClass('EmailInbox',EmailBase);EmailMessage.registerClass('EmailMessage',EmailBase);EmailReply.registerClass('EmailReply',EmailBase);Yoshi.Clusters.EmailProfile.registerClass('Yoshi.Clusters.EmailProfile',EmailBase);TopBar.registerClass('TopBar',Cluster);MagBubble.registerClass('MagBubble',Cluster);FbIdentity.registerClass('FbIdentity',RecordStore);FbFileData.registerClass('FbFileData',FbIdentity);FbDataStore.registerClass('FbDataStore',FbFileData,IDataStore);FbUser.registerClass('FbUser');FbList.registerClass('FbList');FbResult.registerClass('FbResult');FbPaging.registerClass('FbPaging');FbLimitRequest.registerClass('FbLimitRequest');FbOffsetRequest.registerClass('FbOffsetRequest');FbObject.registerClass('FbObject');FbObjectError.registerClass('FbObjectError');FbAuth.registerClass('FbAuth');FbWork.registerClass('FbWork');FbAlbum.registerClass('FbAlbum');FbPhoto.registerClass('FbPhoto');FbTags.registerClass('FbTags');FbTag.registerClass('FbTag');FbNote.registerClass('FbNote');FbImage.registerClass('FbImage');FbComments.registerClass('FbComments');FbComment.registerClass('FbComment');FbSendStorage.registerClass('FbSendStorage');Yoshi.Pages.ProfilePage.registerClass('Yoshi.Pages.ProfilePage',YoshiPage);Yoshi.Pages.EmailPage.registerClass('Yoshi.Pages.EmailPage',YoshiPage);Yoshi.Pages.MagneticListPage.registerClass('Yoshi.Pages.MagneticListPage',YoshiPage);Yoshi.Classes.PkgBase.pkgRx='pkg';Yoshi.Classes.PkgBase.$1_1=0;Yoshi.Classes.PkgBase.$1_2=new Date().getTime();EmailData.sentRx='sent';EmailData.rcvdRx='rcvd';Master.page=Master.$2();Master.$0=(Yoshi.Pages.MagneticListPage).get_name();Master.$1=null;ProfileCluster.$4_3=0;EmailBase.data=null;EmailCluster.$4_A=0;EmailReply.$4_9=EmailReply.$4_A();ProfileBase.data=null;MagBubble.$2_A=0;FbDataStore.$14='http://graph.facebook.com'+'/{0}/picture';FbIdentity.$5='/yoshi/php/fb/'+((window.location.hostname===SiteTheme.localHost)?'fb.authlcl.php':'fb.auth.php')+'?scope='+'publish_stream,read_friendlists,email,user_birthday,user_photos,user_about_me,user_notes';

